Re: n00bie - Use of ANSI and/or UniCode Characters ......
From: Dale King (kingd[at]tmicha[dot]net)
Date: 02/07/04
- Next message: Dale King: "Re: printing large double values without exponential notation?"
- Previous message: Andrew Park: "handling currency / accounting in java?"
- In reply to: Boudewijn Dijkstra: "Re: n00bie - Use of ANSI and/or UniCode Characters ......"
- Next in thread: Boudewijn Dijkstra: "Re: n00bie - Use of ANSI and/or UniCode Characters ......"
- Reply: Boudewijn Dijkstra: "Re: n00bie - Use of ANSI and/or UniCode Characters ......"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 7 Feb 2004 17:57:04 -0500
"Boudewijn Dijkstra" <usenet@bdijkstra.tmfweb.nl> wrote in message
news:4023dabc$0$41758$5fc3050@dreader2.news.tiscali.nl...
> "ImperatorBush" <bk-dd@t-online.de> schreef in bericht
> news:bvvo53$8ba$04$1@news.t-online.com...
> > Hallo all,
> > I have (very) recently started learning to use Java, I have the SunJava2
> > 1.4.2/NetBeans 3.5.1 pack installed, and I have mostly been using
> > command line functions - or 'JCreator LE'(IDE) - for compiling/running
> > the classes - all works just fine!
> > My problem came up as I wanted to use the European currency symbol
> > '?'/Euro/ANSI 128 or hex0080 - as you may well see the character has
> > been typed and is (hopefully) displayed at your end - I just cannot
> > 'persuade' my programm to correctly display
> >
> > "System.out.print((char)128)" as a "?" on sysout.
>
> I hope you have already learned that Java is platform-independant, from
> which you can draw the conclusion that it probably doesn't assume
> Windows-1252 encoding in your source code.
>
> In Java, all characters are by definition Unicode characters. If you want
> to use the Euro-character, use the proper code point for it, which is
> U+20A0. As a char that is '\u20A0', in a String it is "Preis: \u20A0
2,95".
Note U+20A0 is not the official euro symbol. 20A0 was intended to be the
euro symbol, but was changed later. The real Euro symbol is U+20AC.
> Unfortunately, Sun's Java Virtual Machine doesn't always properly convert
> Unicode characters to platform default characters. Run this code and see
> what happens:
Yes, it does properly convert to the platform default characters. Some
things that can complicate this process on Windoze is that the platform
default encoding is Cp1252 which is the Windoze encoding. But the command
line window is often set to the DOS codepage which is different. That is a
problem with Windoze/DOS not Java.
-- Dale King
- Next message: Dale King: "Re: printing large double values without exponential notation?"
- Previous message: Andrew Park: "handling currency / accounting in java?"
- In reply to: Boudewijn Dijkstra: "Re: n00bie - Use of ANSI and/or UniCode Characters ......"
- Next in thread: Boudewijn Dijkstra: "Re: n00bie - Use of ANSI and/or UniCode Characters ......"
- Reply: Boudewijn Dijkstra: "Re: n00bie - Use of ANSI and/or UniCode Characters ......"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|