Read Non-English (Arabic) Filenames in Java

It began when I tried to put Arabic HTML files under the HTTP Apache and tried to access it which didn’t work. Though, I tried to make a work around that included reading the Arabic named HTML files from a Servlet.

The environment I tested that on is Windows with Arabic as the Non-Unicode charset.

I tried to read a file named “عربي.htm” which didn’t work by any chance, when I found out that I need to embed the file name in Unicode, then try to read a file with the specified Unicode name. I found the most simple way to test this is to use windows tool “charmap”, to find each character Unicode.

So it worked like this :

String filename = "\u0639\u0631\u0628\u064A.htm";

FileInputStream fileRead = new FileInputStream(filename);

...

It worked fine!.

Note: Still I am investigating on HTTP Apache to make it read Arabic filenames.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s