Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 38
Registered: ‎09-22-2009
My Device: Not Specified
Accepted Solution

Multiple versions of ASCII characters?

I've had an interesting problem report come in from a customer using Chinese language entry.  For one function of my app, I search to see if there is an at-sign ('@') and the end of a certain string.  The customer was having trouble getting the app to recognize strings with these characters, and then he discovered a solution.  If he just just types everthing in Chinese Entry Mode, including the @, it doesn't work.  If he switches to English Entry Mode when he gets to the @ character, it works.  But the characters look the same according to him.

 

This is all very foreign (no pun intended) to me.  I don't know how to even properly test this condition using Chinese language entry.  At the core is the question of whether there is some different character encoding for the @, or other, standard ASCII characters when in a non-english mode.

 

Anyone know?  Unfortunately the guy cannot send email from his BlackBerry in China or else I'd have him send me the strings.

 

Regards,

Jim

Developer
Posts: 212
Registered: ‎07-18-2008
My Device: Storm 9550

Re: Multiple versions of ASCII characters?

How are you searching for the character?

 

The japanese BB will probably use some special character set where the characters could have a different positions, even the ASCII ones. Always use String methods and never rely on integer values in ASCII table because Java should handle string encodings transparent for you.

If your problem was solved, please mark answer as "Accepted solution"
If your want to thank, click the "kudo" symbol
___________
visit me: http://mobilejavadevelopment.blogspot.com/
visit the Berlin BlackBerry Developer Group: http://berlinblackberrydevelopers.blogspot.com/
Developer
Posts: 27
Registered: ‎09-04-2009
My Device: Not Specified

Re: Multiple versions of ASCII characters?

ASCII is 7 bit and does not support chinese or whatever. Fortunately Java is as far as i know Unicode, meaning you have 2 bytes, that's EBCDIC and supports all kind of signs.

If unsure, print the lenght of a char and you'll see if that's correct.

Developer
Posts: 38
Registered: ‎09-22-2009
My Device: Not Specified

Re: Multiple versions of ASCII characters?

I am using something like:

 

if( testString.endsWith("@") ) {  ..............

 

So, yes I'm using String methods, and consequently 16-bit chars, but I'm unsure whether when I put "@" in my code, it is really the same thing as when someone in another language presses that key.

 

I guess I'm second guessing all of these absolute string tests due to a similar problem I had recently.  I was using the standard .trim() function but it wasn't working well in certain cases.  It turned out that there were certain higher-numbered Unicode whitespace characters that where getting appended to the string but not trimmed (since trim() only looks for the 'standard' ASCII whitespace characters.  See http://en.wikipedia.org/wiki/Whitespace_%28computer_science%29#Unicode ).  My fear is that the "@" character is replicated somewhere in the Unicode space, and that other character is getting appended when the user is in "Chinese" mode.

 

 

Thanks,

Jim

 

 

 

Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Multiple versions of ASCII characters?

[ Edited ]

One idea you can do to see if there are any other chars that are similar is to open up Window's Character Map. You can see all the chars that are supported in a font. Though it is not the same it should be relatively similar to the font's used on BlackBerry. I did a quick look through Arial and couldn't find anything that would look similar to an @ char.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Highlighted
Developer
Posts: 38
Registered: ‎09-22-2009
My Device: Not Specified

Re: Multiple versions of ASCII characters?

I actually found 2 other "Commercial AT" characters on this page:

 

http://unicode.org/charts/normalization/chart_OtherPunctuation.html

 

Perhaps one of those is being used.  Without some test code running that will actually tell me the Unicode char the guy is typing it's hard to tell.

 

I'll close the thread now.  Thanks.