| Reply | « Previous Thread | Next Thread » |
|
Join Date: Mar 2003
Posts: 162
Location: Malaysia-Johor-Pontian Kecil
Offline
Regular Contributor
|
|
Hi,
I'm using canvas to display unicode, my code is like that: g.drawString(new String("\u9879\u76ee".getBytes(), "UTF-8"), 0, 0, 0); But I don't know what's going on. I can see the rectangle words only. Please guide me how to solve it. Thanks. |
|
If you're using an emulator then it might just be that the emulator doesn't support (or is not set up to) the language. Rectangles are often shown when the language isn't supported. Try it out on a real phone (that has that language's font installed of course).
I usually just print out text like this: Code:
g.drawString("\u9879\u76ee", 0, 0, 0);
|
|
Join Date: Mar 2003
Posts: 162
Location: Malaysia-Johor-Pontian Kecil
Offline
Regular Contributor
|
|
Hi,
The emulator is ok (The real device, Nokia7650, is ok as well). I can see the chinese words in List component and title. But only the canvas as such problems. Please guide me how to solve it. Thanks. :) |
|
your unicode escape sequences are wrong..
Remember UTF-8 unicode escape sequence should look like this.. first it takes three unicode escape sequences for each character not two.. Second.. because of the amount of recognized sequences you should be seeing leeadin zeros.. for example: New Game in greek is: \u00CE \u009D \u00CE \u00AD \u00CE \u00BF \u00CF \u0080 \u00CE \u00B1 \u00CE \u00B9 \u00CF \u0087 \u00CE \u00BD \u00CE \u00AF \u00CE \u00B4 \u00CE \u00B9 notice that the mulitple of 3 matches the exact original characters in greek.. what character seq are you trying to display from what language encoding? |
|
Join Date: Mar 2003
Posts: 162
Location: Malaysia-Johor-Pontian Kecil
Offline
Regular Contributor
|
|
Hi,
Thank for your reply. I'm going to display Chinese GB. And the unicode is translated by native2ascii (encoding: MS936, Windows Simplified Chinese ), according to http://java.sun.com/j2se/1.3/docs/gu...oding.doc.html I'm not understanding by the " three unicode escape sequences" u mean. Can you explain the detail ? And how should I do to generate the unicode ? Thanks. Best Regards, chai. |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|