I need to print out the currency sign "¤", but both
System.out.print("¤") and System.out.print("\u00a4") don't work (they
print out a question mark). The sign will be converted into a
backgammon game font. It is part of the bottom border, so the diagrams
are pretty useless without it.
Thanks in advance,
Thomas Koch
Andrew Thompson - 10 Nov 2007 11:45 GMT
>I need to print out the currency sign "¤", but both
>System.out.print("¤") and System.out.print("\u00a4") don't work (they
>print out a question mark). The sign will be converted into a
>backgammon game font. It is part of the bottom border, so the diagrams
>are pretty useless without it.
Good'o. Let us know how that goes.
BTW - if you have any actual /questions/* about that,
this is a good place to ask them.
* You know, those things followed by a question mark,
right?

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Lasse Reichstein Nielsen - 10 Nov 2007 12:08 GMT
> I need to print out the currency sign "¤", but both
> System.out.print("¤") and System.out.print("\u00a4") don't work (they
> print out a question mark).
Sure they work. The specification of the PrinteStream says that the
characters are converted into the platform's default character encoding.
What is the platform? Does its default character encoding include the
curency sign?
> The sign will be converted into a backgammon game font.
Hmm. Maybe. What you appear to really want is to print the *byte* 164,
and then let that be interpreted as something else than the currency
sign, using a non-standard font.
> It is part of the bottom border, so the diagrams are pretty useless
> without it.
You are fiddling with charcters. The first thing to learn when doing
that is that there is no such thing as raw text. All text is
represented by bytes at some level, and there are many incompatible
ways to interpret the same bytes.
If you can rephrase your problem in terms of bytes, then it might
become easier to solve. That either means just talking about bytes, or
talking about characters *and* their encoding.
/L

Signature
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
wintom - 10 Nov 2007 17:05 GMT
> Sure they work. The specification of the PrinteStream says that the
> characters are converted into the platform's default character encoding.
> What is the platform? Does its default character encoding include the
> curency sign?
I set the character encoding to UTF-8. All signs (even the strange
ones) are printed out perfectly except for this currency sign. The
character map shows, that the font does include the sign. Is it
possible, that the system tries to convert it somehow into the local
currency sign? Maybe it would be enough to surpress this? But how?
> > The sign will be converted into a backgammon game font.
>
> Hmm. Maybe. What you appear to really want is to print the *byte* 164,
> and then let that be interpreted as something else than the currency
> sign, using a non-standard font.
Let me give you an example: My program produces a *.tex file
containing a few underscores. After running the *.tex file through
XeLaTeX using the game font, in the final document this underscore
will be shown as the top border of a backgammon board diagram. Now,
for the bottom border XeLaTeX would need the "¤" as an input. But my
program only prints a question mark, which equals a checker instead of
a border.
I think I really nead the character, don't you!? If not, how can I
deal with bytes in this case? I have no idea!?
Thanks for your time!
Thomas Koch
Mark Space - 10 Nov 2007 18:45 GMT
> Let me give you an example: My program produces a *.tex file
> containing a few underscores. After running the *.tex file through
[quoted text clipped - 6 lines]
> I think I really nead the character, don't you!? If not, how can I
> deal with bytes in this case? I have no idea!?
Well, I'm still not 100% sure what you are trying to do. But if you are
having problems with character sets, why not get rid of them? Look at
using DataOutputStream and ByteArrayOutputStream. That should allow you
to write what bytes you want to a stream (or file) with out getting
tripped up by an OutputStreamWriter.
Roedy Green - 10 Nov 2007 21:46 GMT
On Sat, 10 Nov 2007 11:26:12 -0000, wintom
<thomaskoch.privat@gmail.com> wrote, quoted or indirectly quoted
someone who said :
>I need to print out the currency sign "¤", but both
>System.out.print("¤") and System.out.print("\u00a4") don't work (they
>print out a question mark). The sign will be converted into a
>backgammon game font. It is part of the bottom border, so the diagrams
>are pretty useless without it.
see http://mindprod.com/applet/fontshower.html
The font used for the console probably does not support it.
Try printing out all chars 0-255 to help you recognise the encoding
and font. You can control the font in JTextArea where you should be
able to see it.
see http://mindprod.com/jgloss/font.html
http://mindprod.com/jgloss/encoding.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Roedy Green - 10 Nov 2007 21:48 GMT
On Sat, 10 Nov 2007 11:26:12 -0000, wintom
<thomaskoch.privat@gmail.com> wrote, quoted or indirectly quoted
someone who said :
>I need to print out the currency sign "¤", but both
>System.out.print("¤") and System.out.print("\u00a4") don't work (they
>print out a question mark). The sign will be converted into a
>backgammon game font. It is part of the bottom border, so the diagrams
>are pretty useless without it.
The console is the wrong tool for a game. You need a minimal GUI
where you have control of layout and graphics and glyphs.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
wintom - 12 Nov 2007 08:20 GMT
Problem solved: I changed the code from FileWriter to
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new
FileOutputStream(texfile),"UTF-8"));
and now it works perfectly. I guess I had NOT changed the default
encoding to UTF-8... Thanks for your hints!!
Thomas Koch