Use '\uxxx' if referring to single character
(e.g. char c = '\u20ac').
Use "\uxxx" when dealing with strings (e.g.
String str = "This is the Euro symbol \u20ac and
this is the currency sumbol \u00a4").
> -----Original Message-----
> From: William Overington [mailto:WOverington@ngo.globalnet.co.uk]
> Sent: Wednesday, July 19, 2000 8:36 AM
> To: Unicode List
> Cc: email@example.com
> Subject: Using unicode in a Java program
> I am learning to program in Java and wonder if someone could
> kindly point me
> in the right direction as to how I can get unicode character
> codes into my
> programs please. I have written various applets on
> non-unicode topics and
> got them to work successfully. I am aware that Java uses
> unicode for all of
> its characters and strings but thus far I have not been able
> to get any
> character that cannot be typed on an ordinary keyboard into
> the software.
> Here is what I have so far for the present program, which works.
> import java.awt.*;
> public class TryUnicode extends java.applet.Applet
> String textstring;
> public void init()
> textstring="The quick brown fox";
> public void paint(Graphics screen)
> screen.drawString("" + textstring,50,200);
> public void update(Graphics screen)
> Suppose that I wish to get a lowercase c circumflex character
> printed onto
> the screen. As I understand it, this is character (decimal) 265 and
> (hexadecimal) 109. From something I saw a long time ago,
> before I started
> learning Java, I think that I need to put something like
> \u0109 into the
> program somewhere, though whether it is \u0109 or "\u0109" in
> marks or whatever I do not know. Is that correct or is there
> some other
> method please?
> William Overington
> 19 July 2000
This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:21:06 EDT