BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-14-2009, 08:46 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: berlin, germany
Model: 8310
PIN: N/A
Carrier: vodafone
Posts: 163
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default tcp: send special chars

Please Login to Remove!

hi,
some time ago i have asek how to decode special chars on a tcp connection (TCP with , , , ,...).

now i want to send special chars, so that an windows-service could read the string without any errors. so i have tried this here:
Code:
  byte[] theByteArray = ((String)sendList.elementAt(0)).getBytes();
                                String strSendString = new String(theByteArray,"UTF8");
                                os.write(strSendString.getBytes());
                                System.out.println("gesendet: "+strSendString);
                                sendList.removeElementAt(0);
                                os.flush();
but i always get an ? instead of an ,, or .... the output in the console is correct.

so now i developed a desktop application in vb.net, which also sends a UTF8-decoded string. and there i've git no problems with:
Code:
 myBuffer = System.Text.Encoding.UTF8.GetBytes(Data)
                               myTCPClient.GetStream.Write(myBuffer, 0, myBuffer.Length)
                        myTCPClient.GetStream.Flush()
so maybe someone could help me...? is there an option on the bes oder on the BB?

thanks hibbert
__________________
My English is so bad, that makes me nobody so quickly after
Offline  
Old 04-14-2009, 04:26 PM   #2 (permalink)
New Member
 
Join Date: Apr 2009
Model: -
PIN: N/A
Carrier: -
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

How about this?

Code:
byte[] theByteArray = ((String)sendList.elementAt(0)).getBytes("UTF-8");
os.write(theByteArray);
System.out.println("gesendet: "+new String(theByteArray, "UTF-8"));
sendList.removeElementAt(0);
os.flush();

Last edited by klyubin : 04-14-2009 at 04:26 PM. Reason: Fixed a typo
Offline  
Old 04-15-2009, 04:13 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: berlin, germany
Model: 8310
PIN: N/A
Carrier: vodafone
Posts: 163
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi...
erm... i have tried it, but... no but. it works fine

thanks =)

kind of regards hibbert
__________________
My English is so bad, that makes me nobody so quickly after
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Cypress Semiconductor Cy3217 Psoc 1, w/ Miniprog, Usb Cable, Prog. Kit
$24.95
Cypress Semiconductor Cy3217 Psoc 1, w/ Miniprog, Usb Cable, Prog. Kit picture1PCS KD224505 KD-224505 Semiconductor IGBT Module
$13.03
1PCS KD224505  KD-224505 Semiconductor  IGBT Module   picture( 9 PC. ) HARRIS SEMICONDUCTOR CD 4076 BE IC 16 PIN DIP
$15.95
( 9 PC. ) HARRIS SEMICONDUCTOR CD 4076 BE IC 16 PIN DIP picturePeak DCA75 Atlas Advanced Semiconductor Analyser with Curve Tracing
$148.9
Peak DCA75 Atlas Advanced Semiconductor Analyser with Curve Tracing pictureNational Semiconductor Overture LM3876T 56W Audio Power Amplifier with Mute
$5.0
National Semiconductor Overture LM3876T 56W Audio Power Amplifier with Mute picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.