BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-14-2008, 10:36 AM   #1 (permalink)
New Member
 
Join Date: Jun 2008
Model: 324
PIN: N/A
Carrier: at&t
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Convert Unicoded text into corresponding character returns by getPayLoadText() method

Please Login to Remove!

Hi,

I want to read and parse the data when SMS message is arrived or sent. i read successfully by the method getPayloadText() of TextMessage class when message is in text format and less then 160 characters.

but if the message contians special characters like '&','_' etc it gives me its unicode character

for e.g it returns '\u0011' of '_' and '\u0000' of '@' character respectively.

please help me how do i convert it into its corresponding character becuase i don't know how many special characters will be in message.

Please let me know any sample code or tutorial

Thanks
Sohail
Offline  
Old 07-14-2008, 01:09 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

There is a special String class constructor that accepts a byte[] array and an encoding string, like "UTF-8".

public String(byte[] bytes,
String enc)
throws UnsupportedEncodingException

Take a look at the String class in the API reference.
Offline  
Old 07-15-2008, 10:14 AM   #3 (permalink)
New Member
 
Join Date: Jun 2008
Model: 324
PIN: N/A
Carrier: at&t
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, but i have already converted string from getPayloadText() method. if i convert with getBytes("UTF-8"), it will convert the converted character (returns from getPayloadtext() like (test\u0011sohail) into bytes.it doesn't converted into its actual representation of Unicode character.

so i want the routine which will convert unicode character into UTF-8 string

Regards
Sohail
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

New American Reliance 9850UV E/EEPROM Programmer
$9.99
New American Reliance 9850UV E/EEPROM Programmer picture**NEW IN BOX** MITSUBISHI PLC FX-EEPROM-4 MEMORY MODULE
$39.99
**NEW IN BOX** MITSUBISHI PLC FX-EEPROM-4 MEMORY MODULE pictureNew Total Phase EEPROM Programming Kit TP120510 Program I2C EEPROMs and SPI
$235.54
New Total Phase EEPROM Programming Kit TP120510 Program I2C EEPROMs and SPI  picture56-PCS IC 24LC01B/SN EEPROM 1KBIT 400KHZ 8-PIN SOIC MICROCHIP 24LC01B/SN 24LC01
$9.0
56-PCS IC 24LC01B/SN EEPROM 1KBIT 400KHZ 8-PIN SOIC MICROCHIP  24LC01B/SN 24LC01 picture12-PCS MEMORY IC X24C00P EEPROM SERIAL 128-BIT 16 X 8 5V 8-PIN PDIP XICOR 24C00
$18.89
12-PCS MEMORY IC X24C00P EEPROM SERIAL 128-BIT 16 X 8 5V 8-PIN PDIP XICOR 24C00 picture






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