The moose likes Java in General and the fly likes problem with dot-matrix printing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "problem with dot-matrix printing" Watch "problem with dot-matrix printing" New topic

problem with dot-matrix printing

Hugh Lloyd

Joined: Feb 20, 2013
Posts: 2
Hi, wasn't too sure if i was meant to post this here or beginners, but here's the problem anyway:

I've written a program that prints out names onto 0.9cmx5cm labels on a dot matrix printer. it works... on the whole, but after i started to really test it i noticed that some characters didn't come out right. the main one is ü (u with 2dots above it) it comes out as ⁿ (small n). I've tried making a character variable as 0252 and 0x81 and 0xFC but it either comes out as the little n or a ? when printer out. I've also tried various ESC codes for the printer (Epson lq-300+II) to allow ASCII codes after 128 to be characters but nothing. It wouldn't be that bad but the old program (written in vb 1.0) has no problem with the characters. i'll paste some code as an example of how i try to print them out.

any idea's?
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

What charset is the printer expecting?

You'll have to look at the printer's documentation to see what code point it expects to receive for the ü character, for a start. Then you'll need to find out which Java charset represents the ü character by that code point. Finally, use a PrintWriter instead of a PrintStream so you can specify the charset. Right now your PrintStream is using your system's default charset, which apparently isn't the right choice.
Hugh Lloyd

Joined: Feb 20, 2013
Posts: 2
Thank you! that solved it!
I agree. Here's the link:
subject: problem with dot-matrix printing
It's not a secret anymore!