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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
funkym
Posts: 39
Registered: ‎04-01-2008
Accepted Solution

getDevicePhoneNumber() delivers phone number with unicode left-to-right mark


I am using getDevicePhoneNumber(boolean format) ( http://www.blackberry.com/developers/docs/4.6.0api/net/rim/blackberry/api/phone/Phone.html#getDevice...(boolean) ) to get my device's phone number. I know this might not be the actual number. I also cannot use anything else like the device pin. I use this to fill a "my phone number" field by default which can be edited manually in case the number is not correctly read from the SIM card.

It is actually working fine and shows the phone number in the field. However, a closer look to the string shows that it has the unicode mark "%E2%80%8E" in front of the string. This mark is known as unicode (utf-8) "LEFT-TO-RIGHT MARK" ( sources: http://www.tachyonsoft.com/uc0020.htm and http://unicode-search.net/unicode-namesearch.pl?term=mark ).

I only experienced this in BB OS 4.6 devices (didn't check 4.7 yet), but it seems not to occur in OS 4.5 and below.

Has there been any changes for the string orientation in OS 4.6?

Can I get rid of that mark by using String.trim(); or do I need to use something else?
Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008

Re: getDevicePhoneNumber() delivers phone number with unicode left-to-right mark

Is it happening for both cases like "getDevicePhoneNumber(true)" an d"getDevicePhoneNumber(false)".

Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
funkym
Posts: 39
Registered: ‎04-01-2008

Re: getDevicePhoneNumber() delivers phone number with unicode left-to-right mark

I didn't try to get the formatted number yet because I actually cannot work with that. I am using the unformatted (false) getter only.
Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008

Re: getDevicePhoneNumber() delivers phone number with unicode left-to-right mark

Can you please list the devices you tested on. I tried on simulator 9000 and JDE 4.6 it works as desired.

Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
funkym
Posts: 39
Registered: ‎04-01-2008

Re: getDevicePhoneNumber() delivers phone number with unicode left-to-right mark

AFAIK this does only appear on a real Bold device. Didn't try the Storm yet because I don't have one :smileysad:
Please use plain text.
Administrator
MSohm
Posts: 13,066
Registered: ‎07-09-2008
My Carrier: Bell

Re: getDevicePhoneNumber() delivers phone number with unicode left-to-right mark

What version of handheld software are you running on the BlackBerry Bold?  You can find this under Options, About on the BlackBerry Smartphone.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
atleta
Posts: 71
Registered: ‎03-10-2009

Re: getDevicePhoneNumber() delivers phone number with unicode left-to-right mark

The same happens with Phone.getDisplayPhoneNumber (see http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=29411 ). This seems to be on OS 4.6 only and not below (4.5) or above (4.7). I only have a 4.5 device, so I've only seen this on the emulator.
Please use plain text.
New Developer
jmercereau
Posts: 3
Registered: ‎08-30-2009

Re: getDevicePhoneNumber() delivers phone number with unicode left-to-right mark

This problem persists on my Bold 9000 but not any of my other GPS enabled phones.

 

Since it was a pain to try to figure out, here's the code I used to resolve this issue.

 

private String trimPhoneNumber(String phoneNumber){ byte phoneBytes[] = phoneNumber.getBytes(); int length = phoneNumber.length(); int offset = 0; if ( phoneBytes[0] == 0x3F ) { length--; offset++; } return new String(phoneBytes, offset, length); }

 

Please use plain text.