Using supplementary Unicode characters

I want to use unicode characters with codepoints greater than U+FFFF in the java code. So, wrote a small code to check the same:

-

int cp = 0x10177;

char[] ch = new char[2];

ch = Character.toChars(cp);

int low = ch[0];

int high = ch[1];

String st = new String(ch);

BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("krishna.xml"), "UTF-8"));

out.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");

out.write("<krishna>");

out.write(st);

out.write("</krishna>");

out.close();

-

But, when I open the xml in browser, the character is not displayed properly.

However the code works for the case where the code point is less than 0XFFFF(Here, I create the String using another constructor which takes an

int[], offset, length). In this case, the xml has the proper character. So, is

the above way of dealing with supplementary characters correct? If wrong,

what is the correct way to handle supplementary characters in the code?

Thanks,

Krishna.

[1127 byte] By [krsethur1a] at [2007-10-2 14:28:24]
# 1
Hi, the code you post produces the bytes "f0 90 85 b7" to the file, which is U+10177 encoded in UTF-8, at least according to a character-map application I have.Does it produce different bytes on your system?
jsalonena at 2007-7-13 12:49:11 > top of Java-index,Desktop,I18N...
# 2

Hi,

Thanks for your reply. I get the same sequence of bytes: F0 90 85 B7. But, the problem is when I view this xml file in browser, the character is not displayed properly. It shows ��. However the unicode character corresponding to this code point is a different symbol. So, is the browser not rendering this character properly. If so, is this issue with browser in not being able to display any code points greater than 0XFFFF. What should be done to make the browser render the code points greater than 0XFFFF?

Thanks,

Krishna.

krsethur1a at 2007-7-13 12:49:11 > top of Java-index,Desktop,I18N...
# 3
You need to install a font that has a glyph for this character. Following the info at http://www.unicode.org/charts/fonts.html you get here: http://scholarsfonts.net/cardofnt.html the page claims the font supports Ancient Greek Numbers, looks promising
jsalonena at 2007-7-13 12:49:11 > top of Java-index,Desktop,I18N...