(Probably simple) problem with displaying Unicode characters



Hi all,

I am getting back into Java programming after a long layoff and now
that I'm doing it everyday, I'm remembering the things I enjoyed about
it and the things that I find maddening. :) I'm trying to write a
simple program to both test my old skills as well as develop code for
use later, when I will need it on a later project.

Right now I'm simply trying to display a Unicode character in the
Eclipse output window. I have a full-up WinXP system with a ton of
fonts (more on that in a moment) but don't seem to see what is wrong
with my program.

I never did much with Unicode years before and never had it succeed for
me then, either, if I recall correctly. But I don't think the
process/requirements are that hard:

- Have Unicode fonts installed
- Use the correct encoding in the Java output stream
- Look up the correct character(s) in the Unicode tables

Here's the program as it stands now (one file called Main.java):


import java.io.*;

public class Main {

/**
* @param args
*/
public static void main(String[] args) throws
UnsupportedEncodingException {
String unicodeMessage = "\u03B2";

// Print out a Unicode character
System.out.println("We attempt to print out the Greek character
beta:");
PrintStream output = new PrintStream(System.out, true, "UTF-8");
output.println(unicodeMessage);
}
}

Here's the output I get:

We attempt to print out the Greek character beta:
β


Please, can someone spot the (probably simple) error in my
setup/coding? Thanks!

Mike

.



Relevant Pages

  • Re: Symbol problems in Word 2004 for mac
    ... >> Visual Basic for the Macintosh does not support Unicode strings. ... > Klaus, it's not true that Word X can insert the correct Unicode character ... > the Unicode character if you the bring the doc over to WinWord: ...
    (microsoft.public.mac.office.word)
  • Latex and Unicode
    ... The data is entered into the XML file by editing it with a Java-based Application, which allows to copy formatted content into the editing fields. ... but it also generates a problem: it allows to enter any unicode character into the XML file. ...
    (comp.text.tex)
  • Re: Redefining how a standard object prints
    ... >> of pointers to Unicode character structures. ... The only way I can control it is by creating a Unicode ... Say you encode the string ...
    (comp.lang.lisp)
  • Re: Unicode value of a character
    ... > I am a beginner in Java programming and I would like to know which ... If you have the character in a Java 'char' data type, ... If you'd like to get the Unicode value in a different ...
    (comp.lang.java.programmer)
  • Re: Byte size of characters when encoding
    ... Strings in .NET are already Unicode encoded. ... So if you encode the ... string to an array of bytes, ... for UTF8 encoding a single Unicode character can be encoded ...
    (microsoft.public.dotnet.general)