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
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: Arabic language support for app dev

Unknown chars in ISO-8859-1 are converted to '?' so if all you see if a bunch of ??????... then somewhere it is getting converted to the default format. On screen do you see Arabic chars? If not then that is the first problem, if you do then I don't know why it is getting converted to ISO-8859-1 before it is returned.

---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.
Please use plain text.
Trusted Contributor
harsha973
Posts: 134
Registered: ‎05-31-2010
My Device: 8300

Re: Arabic language support for app dev

My eclipse is able to show arabic text and i am able to add static arabic text directly to Label,this arabic text is displayed correctly on my simulator.The issue occured  when i'm trying to get the dynamic arabic text typed in EditField or BasicEditField or TextField and post that data to the url.

 

I'm also able to get the arabic text from url and able to display that text also,but im not able to post the dynamic arabic text(from editfield) to url.

 

Thanks in advance.

 

Sree Harsha.P

 

 

Please use plain text.
Developer
JCarty
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Arabic language support for app dev

[ Edited ]

From what I know, the simulators are English-only unless you find one that is set for a particular language/locale.

 

If the input language can be switched to Arabic, then this should work fine. However, if the locale necessary to show the proper characters is not installed nor is support for Arabic fonts, then it may show question marks or boxes.

 

Do you have a device that you can try this on?

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Please use plain text.
Trusted Contributor
harsha973
Posts: 134
Registered: ‎05-31-2010
My Device: 8300

Re: Arabic language support for app dev

My simulators are perfectly disp[laying arabic text...i think this is not an issue....

 

Thanks & regards,

Sree Harsha.P

Please use plain text.
Developer
JCarty
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Arabic language support for app dev

So the problem is occuring when you are attempting to POST via an HttpConnection using arabic characters?

 

Is that the only problem? I just jumped in on this one. Pardon me if I haven't followed 100% yet.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Please use plain text.
Trusted Contributor
harsha973
Posts: 134
Registered: ‎05-31-2010
My Device: 8300

Re: Arabic language support for app dev

yeah,the problem is when we are getting an arabic text from editfield(inputmode changed to arabic)  and converting into string(here the problem is occuring converting and storing in string aas ????).then im attaching that string to url to post the data.

 

Thanks & Regards,

Sree Harsha.P

Please use plain text.
Developer
luisfernando
Posts: 91
Registered: ‎11-24-2009
My Device: Storm

Re: Arabic language support for app dev

Hello harsha,

 

I saw few months ago a StringFactory class that use logicmail. As far as I know they support arabic characters using that class. Take a look and please read the disclaimer on how to use it.

 

http://www.logicprobe.org/proj/logicmail/browser/trunk/LogicMail/src/org/logicprobe/LogicMail/util/S...

 

And they just use it like:

 

 

StringFactory.create(textBytes, charset);

 

You will have to do your own implementation from that class into your project.

 

-Luis Fernando

Remember to give Kudos(click on the star at your left) if this helped you.
Click on "Accept Solution" if the problem is resolved.
Espanol? Escribeme un mensaje privado.
Please use plain text.
Trusted Contributor
harsha973
Posts: 134
Registered: ‎05-31-2010
My Device: 8300

Re: Arabic language support for app dev

[ Edited ]

Hi guys,

 

I got an improvement.I'm able to get the unicode like:

 

        \u0628\u0644\u0645\u0646\u0628\u0644

 

 

the function i used to convert to  unicode is:

 

 

#
public class unicodeString
#
{
#
public static String convert(String str)
#
{
#
StringBuffer ostr = new StringBuffer();
#
 
#
for(int i=0; i<str.length(); i++)
#
{
#
char ch = str.charAt(i);
#
 
#
if ((ch >= 0x0020) && (ch <= 0x007e)) // Does the char need to be converted to unicode?
#
{
#
ostr.append(ch); // No.
#
} else // Yes.
#
{
#
ostr.append("\\u") ; // standard unicode format.
#
String hex = Integer.toHexString(str.charAt(i) & 0xFFFF); // Get hex value of the char.
#
for(int j=0; j<4-hex.length(); j++) // Prepend zeros because unicode requires 4 digits
#
ostr.append("0");
#
ostr.append(hex.toLowerCase()); // standard unicode format.
#
//ostr.append(hex.toLowerCase(Locale.ENGLISH));
#
}
#
}
#
 
#
return (new String(ostr)); //Return the stringbuffer cast as a string.
#
 
#
}

 

 

Now,how can i convert this unicode to a string ?i.e converting unicode to arabic text?

 

 

Thanks & regards,

Sree Harsha.P

Please use plain text.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: Arabic language support for app dev

That's a good sign that you are getting the proper data out of the String. Now you don't really need that function since you basically just confirmed that the data is being returned from the EditField with Arabic chars... it is coming from the EditField and not from some other source right?

 

Either way you had the code before (*string*.getBytes("UTF-8")) which will retain that data and allow you to easily send it to wherever you need, or you can keep the String as-is as long as it is on the BlackBerry (otherwise you have to do the UTF-8 thing again).

---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.
Please use plain text.
Trusted Contributor
harsha973
Posts: 134
Registered: ‎05-31-2010
My Device: 8300

Re: Arabic language support for app dev

[ Edited ]

hi guys,

 

i'm strucked in conversion from unicode to String.

 

let me give me some ex:

 

String dummy String=new String("\u006e\u006f\u0073\u0070\u0061\u0063\u0065\u0073".getBytes,"UTF-8);

 

it is working fine...converting into the string "nospace".

 

if the string is initialised like

 

String dummy="\\u";

String dummyString=new String((dummy+"006e").getBytes(),"UTF-8");

 

the above dummy string is not converting into the string "n".it is converting like "\u006e" but not detecting it as an unicode.

 

Wats the problem actually .I'm not getting it.

how can i change the unicode to string.?

 

Thanks for ur patience.

 

Sree Harsha.P

Please use plain text.