> Hi all
>
> i'm trying to write to a file an arabic Character but
> when i did ,the fils has squear sign not char
>
> what to do to solve the problem?
First you have to identify what the problem is.
1) As flounder suggested you need to make sure you are displaying the character using a program that can and has a glyph that will show the character correctly.
2) How are you writing this character? Please post your relevent formatted code where you open this file and where you write this character to it.
If you see question marks then you have an encoding error. If you see rectangular boxes then you are using a font that cannot render the characters. I believe that your "squear sign" is the rectangular box.
So the problem is with whatever you are using to look at the file. (There could also be a problem with your code that writes to the file, but that is less likely.)
I believe that your "squear sign" is the rectangular box.
That's right
here is the coding that i'm using
and when i try to use that rectangular box the program is confiused between words that have the same number of letters
String enc="UTF8"
Local loc= new Local("ar");
Wrt= new PrinterWriter( new BufferedWriter(new OutputStreamWriter(new FileOutputStream("file.txt"),
enc)));
how can i change the font ?
Message was edited by:
TheNewLeader
Your problem is either that you're writing the file incorrectly, or that the program you use to view the file is not displaying it correctly.
For the first possibility, in that last code snippet you showed, you were using "UTF8" as the encoding, have you changed that to "UTF-8" yet? I'm pretty sure that makes a difference.
As for the second, what viewer are you using to display the files after you write them? Does it give you a way to specify what encoding to use when you open it?
> i'm using the UTF-8 for writing and am view my files
> in notebad
> i was able to read from an arabic file and view it
> but when i tried to write it gave me that strange
> char
>
> even i know how to write to files since i use it for
> english
Post the code you're currently using to write the file.
Notepad supports UTF-8, but you might have to force it to use it. Open Notepad, then choose File/Open. When you open the file, manually change the encoding from Unicode to UTF-8. I don't know if that makes a difference, but it's worth a shot.
This is the code that i use for writing
PrintWriter out=
new PrintWriter(
new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream("write.txt"),
enc)) );
> This is the code that i use for writing
>
> PrintWriter out=
> new PrintWriter(
> new BufferedWriter(
> new OutputStreamWriter(
> new
> new
> FileOutputStream("write.txt"),
>
>
>enc)) );
That's where you create the PrintWriter, but where's the code where you actually write to it?