This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Character Encoding Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Character Encoding" Watch "Character Encoding" New topic
Author

Character Encoding

Prem aswin
Greenhorn

Joined: Nov 25, 2010
Posts: 2
Hi,

I have a text file that downloaded from mainframe dataset.. text file downloaded in windows Cp1256 format.

when I open the text file the arabic character contain like "ÇáåæÊíá /ÔÑßÉ ÇáÍÓíäÇä"

I try to convert by below code to display properly

String Result= new String(tokenizer.nextToken().getBytes("windows-1256"), "utf-8");

but its showing ???...

how I can convert this to display properly in arabic.

Please help.


Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12911
    
    3

Prem aswin wrote:when I open the text file the arabic character contain like "ÇáåæÊíá /ÔÑßÉ ÇáÍÓíäÇä"

Where and how are you displaying the text? Does your Java program display them in a console window or terminal window, or in a Swing GUI?

Prem aswin wrote:but its showing ???...

Are you using a font that contains Arabic characters to display the text? If you see question marks or empty boxes, it's usually a sign that you are using a font that doesn't contain Arabic characters.

To specify with which encoding you want to read the file, and not convert it afterwards, do something like this:



Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Prem aswin
Greenhorn

Joined: Nov 25, 2010
Posts: 2
Thank you very much Mr. Jesper.

Iam displaying the text in browser..

Now its working prefectly...

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32654
    
    4
And welcome to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Character Encoding
 
Similar Threads
Problems while trying to write arabic letters to a file
Mail Content problem for Arabic & Hebrew language
Need Help ...to read text file.....???
problem inserting arabic data
NumberFormat does not show right currency symbol