displaying arabic using j2me
hi every body,
my experience with j2me is very little and i need to display arabic text
i am using eclipse and carbide j1.5
i searched the forum and i found that writing the following should work
String s=new String("arabic_string".getBytes(), "UTF-8");
but when i display s it appears like ?
i used
String en= System.getProperty("microedition.encoding");
String lc= System.getProperty("microedition.locale");
the ecoding is ISO8859-1
and the locale is en or ar according to the setting of the phone language
i am testing on deviced nokia n73 and nokia 6630
i got the same output with the 2 device
urgent help is required plz
and if any body has a sample code that would be great
thanks
[788 byte] By [
raghdaa] at [2007-11-27 5:36:48]

hi every body,i really need urgent help in this issue i am lost and i found no answer for my questionif any body know any thing about this problem plz send it
Shouldn't the encoding be something arab specific? ISO-8859-1 is for regular "english" characters + some "special" chars (to some) like 漩?
thanks for reply but i tried this by the same way
String s=new String ("\u###\u###".getBytes(),"ISO-8859-1");
but it is not working also
i checked my mobile encoding and it is ISO-8859-1 but this way to dispaly the string is not working
does ISO-8859-1 have encoding table like the unicode ?
i tried the string in arabic letters instead of "\u###" but it is not working also
if anybody could help plz do
thanks
> i checked my mobile encoding and it is ISO-8859-1 but
> this way to dispaly the string is not working
Are you sure it's using code page 1? This one doesn't contain arabic letters, code page 6 does (ISO-8859-6).
> does ISO-8859-1 have encoding table like the unicode ?
See for example:
ISO-8859-1
http://www.tachyonsoft.com/iso88591.htm
ISO-8859-6
http://www.tachyonsoft.com/iso88596.htm
hi,thanks for reply but i am sure that its using ISO-8859-1i had a look at the tables and i can see that ISO-8859-1 does not support arabic but i dont know how to solve this problemif u have any idea plz let me know thanks
> thanks for reply but i am sure that its using ISO-8859-1
Strange.
Do you get latin or arabic letters if you print the following String?
new String(new char[] { 0x00c1, 0x00c2, 0x00c3 });
> i searched the forum and i found that writing the> following should work> String s=new String("arabic_string".getBytes(),> "UTF-8");Where did you find this rubbish?
salam raghda ,
I am experience with arabic text. i use also eclipse
this is what you need :
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.sql.SQLException;
public class font {
public static void main(String[] args){
String word_temp="轻菅忧?;
try {
word_temp = new String(word_temp.getBytes("utf8" ));
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
System.out.println(word_temp);
}
}
any help you are welcome
Faraj
hi faraj,
iam happy that i found someone experienced with arabic but unfortunatly your suggestion is not working with me.
i got UnSupportedEncodingException :Encoding UTF8 not found
and the arabic word is displayed like that ?
if u have any idea why this is happening plz let me know
and thanks alot for help
hi quitte,i got latin letters when i tried this
> if u have any idea why this is happening plz let me> know> <sigh/>
-Hi raghda and Saber ,
Since you use Eclipse , You have also to click the right button of your mouse in the program name (font.java) then click on Run (green) then click on common then you will see the default encoding which is iso- 8859-1 just change it to UTF8 and it will work perfect. actually this is an easy problem. in case you couldn't solve the problem please both of you send me an email and i will send you all secreens shots which will help you to do that. my email farag_ahmed@yahoo.comregards
Faraj
You may need to install Arabic support onto the phone. My experience with PocketPC and CDC/PP was that "arabizer13bn277" from www.imaginet-software.net provided support which was picked up by IBM's J9.
hi YAT_Archivist
my mobile already can read arabic applications and i have alot of arabic applications running on it and work fine
the problem of displaying arabic is only with my application
either i am coding in awrong way or i am missing something to include
if any body have any idea what i should do plz tell me
thanks
Does the following test string display arabic letters for you?String s = "\u0628\u0629\u062a";
hi quitti is this utf8?plz tell me how to display this?do u mean to doString s=new String("\u0628".getBytes(),"UTF-8");thanks
> String s=new String("\u0628".getBytes(),"UTF-8");
>
<sigh/> This is NEVER right! It says convert the string to bytes using the default encoding and then pretend that these bytes are utf-8 and convert them back to a Stringl
I say again, it is NEVER right to do this.
ok sabretill now u r right it never worked with me but do u have any idea how we can solve the problem?
If you can't display Arabic characters then it seems to me that your problem is that the font being used to try to display the characters does not contain glyphs for the Arabic characters. Since I don't know anything about j2me I don't know how to fix this.
> is this utf8?
No, it's a Java String consisting of Unicode escape sequences for those chars which are not part of the basic ASCII set. These sequences are resolved by the compiler and translated to UTF-16 (Unicode) Java characters internally.
> plz tell me how to display this?
Just print/display the String as you're used to do.
> do u mean to do
> String s=new String("\u0628".getBytes(),"UTF-8");
No, Sabre is right. Juggling around the characters from conversion to conversion in the hope of a right result is not a good idea. You need UTF-8 only if you want to save textual data to a system which does not support Unicode by a multibyte character set such as typical file systems or network transfers.
thaks quitti
i tried what u said"\u0628\u0629\u062A"
i am testing on nokia n73 and nokia 6630
it worked on n73 and now i can see arabic letter
but 6630 displayes
062C#062D
any idea why is this happening
note the 6630 supports arabic and i already have arabic applications working on it
thanks for help
> 062C#062D> any idea why is this happening No idea. Are you sure it's displaying the example text I gave you? Codes 062c and 062d aren't part of this text, maybe you included some other code/text which is responsible for this?
sorry quittiit was my fault now its working fine evey where thank u very much for ur help i really appreciate that