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 ?
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
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
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.
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
He puts the "turd" in "saturday". Speaking of which, have you smelled this tiny ad?