File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Cyrillic Characters

 
Meet Gaurav
Ranch Hand
Posts: 492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a java code thats prints text files fine without any issues. But I tried to print some cyrillic and greek characters, but its printing some junk characters and I tried the same using wordpad its printing fine.

Whether java is trying to print using own font set ? How to change that ?


 
Meet Gaurav
Ranch Hand
Posts: 492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cyrillic and Greek fonts are installein my machine..
 
Campbell Ritchie
Sheriff
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean printing on paper, not on the command line?
 
Meet Gaurav
Ranch Hand
Posts: 492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes printing on paper.. I posted the printing code in my previous post.. Please help me out on this
 
Campbell Ritchie
Sheriff
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know, sorry.

I think this is too difficult a question for the beginners. Moving.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any suggestions will be appreciated.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google for Joel on Software unicode article, it will tell you why this is happening.... basically you need to ensure that the character encoding is supported internally within your javacode, externally by any viewers/OS and externally by print drivers etc
 
Albareto McKenzie
Ranch Hand
Posts: 299
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martijn Verburg wrote:Google for Joel on Software unicode article, it will tell you why this is happening.... basically you need to ensure that the character encoding is supported internally within your javacode, externally by any viewers/OS and externally by print drivers etc


You mean this: http://www.joelonsoftware.com/articles/Unicode.html

Good luck!
 
Meet Gaurav
Ranch Hand
Posts: 492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess nothing related to my issue.

even this too http://www.freeutils.net/source/jcharset/
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using DocFlavor.INPUT_STREAM.AUTOSENSE, you need to actually specify the character encoding of the data. For example, if your file is stored as UTF-8, use DocFlavor.INPUT_STREAM.TEXT_PLAIN_UTF_8 . AUTOSENSE isn't going to figure this out by itself. It definitely doesn't care about character encoding.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ernest thanks for the reply. I have a file that contains cyrillic characetrs and the file is stored as a text file only. even I tried with all options of DocFlavor.INPUT_STREAM

public static final INPUT_STREAM TEXT_PLAIN_HOST;
public static final INPUT_STREAM TEXT_PLAIN_UTF_8 = new INPUT_STREAM("text/plain; charset=utf-8");
public static final INPUT_STREAM TEXT_PLAIN_UTF_16 = new INPUT_STREAM("text/plain; charset=utf-16");
public static final INPUT_STREAM TEXT_PLAIN_UTF_16BE = new INPUT_STREAM("text/plain; charset=utf-16be");
public static final INPUT_STREAM TEXT_PLAIN_UTF_16LE = new INPUT_STREAM("text/plain; charset=utf-16le");
public static final INPUT_STREAM TEXT_PLAIN_US_ASCII = new INPUT_STREAM("text/plain; charset=us-ascii");

Any other suggestions please
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic