Hello
I'm writing java code read arabic character but it don't show the text correctly it show squares Any one Can help me any help will be appreciated
Thanks

Yours
Ahmed Ghazey

Recommended Answers

All 7 Replies

Hello
I'm writing java code read arabic character but it don't show the text correctly it show squares Any one Can help me any help will be appreciated
Thanks

Yours
Ahmed Ghazey

Can I see your code please?

By Allah Willing I do it Thanks All and this is the code

public void unicodeShow(String fileName) throws UnsupportedEncodingException, FileNotFoundException, IOException{
        Reader reader = new InputStreamReader(new FileInputStream(fileName), "utf-8");
        BufferedReader br = new BufferedReader(reader);
        String a=br.readLine();
        System.out.println(a);
    }

by Ahmed Ghazey
FCI CU
Egypt

I see the thread is marked as solved.
If you have solved your problem, could you please post your solution so the next person with the same problem can find the solution here.
Thanks

Sorry I don't Understand you if You read my Comment You will see the Solution I put it when I get The Solution immediately
Thanks For Attention You are right but you must read all the Comments
Thanks Again
Yours
Ahmed Ghazey
FCI CU

It happends with Chinese characters as well. I think this is probably due to the computer system (windows' config) where your output is printed.

You can see the output in the any specific file, because some IDE not supported UTF-8 for text file encoding(Ex, in Eclipse go to the
Windows/Preferences/General/Workspace
In the Text file encoding
select in the Other the UTF-8 to change the encoding)

public static void writeTiFile(String fileName,String str){
        try {
            FileOutputStream out = new FileOutputStream(fileName);
            out.write(str.getBytes("windows-1256"));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

thanks to all of you you helped me alto with my code
:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.