• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Character Encoding

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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:


 
Prem aswin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much Mr. Jesper.

Iam displaying the text in browser..

Now its working prefectly...

 
Marshal
Posts: 80874
506
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And welcome to JavaRanch
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic