You Are Here:

Community: Developer Discussion Boards

#1 Old Using canvas to display unicode. - 2003-06-12, 16:17

Join Date: Mar 2003
Posts: 162
Location: Malaysia-Johor-Pontian Kecil
akokchai
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.
Reply With Quote

#2 Old 2003-06-15, 08:50

Join Date: Mar 2003
Posts: 2,280
Location: Israel
shmoove
Offline
Forum Nokia Champion
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);
with no problems at all.
Reply With Quote

#3 Old 2003-06-16, 06:27

Join Date: Mar 2003
Posts: 162
Location: Malaysia-Johor-Pontian Kecil
akokchai
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. :)
Reply With Quote

#4 Old Unicode format wrong - 2003-06-18, 23:13

Join Date: Mar 2003
Posts: 90
Location: USA
badappleFG
Offline
Senior Member J2ME Expert
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?
Reply With Quote

#5 Old 2003-06-19, 03:29

Join Date: Mar 2003
Posts: 162
Location: Malaysia-Johor-Pontian Kecil
akokchai
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 With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia