Home arrow Java arrow Page 2 - J2ME and Unicode
JAVA

J2ME and Unicode


javaIf you've ever run into problems faced with multi-lingual text differences, Jason's latest article will solve just that.  Learn how to make use of Unicode character-sets when developing in a J2ME-based environment, where you'll more than likely have a need to develop MIDlets in multiple languages.

Author Info:
By: Jason Lam
Rating: 5 stars5 stars5 stars5 stars5 stars / 99
December 26, 2003
TABLE OF CONTENTS:
  1. · J2ME and Unicode
  2. · Enabling the J2ME Emulator with Unicode
  3. · Simple Unicode Test
  4. · Read Unicode File
  5. · Reading a Text File with Unicode Codes
  6. · Conclusion

print this article
SEARCH DEVARTICLES

J2ME and Unicode - Enabling the J2ME Emulator with Unicode
(Page 2 of 6 )

There is one more required step needed to properly display Unicode characters, that is to ensure the display itself can support Unicode; in this case the emulator screen.  You will also need to obtain the appropriate fonts.  For example, if you want to display Japanese characters you will need the MS Mincho font.  After installing the font on your system you will now need to edit the properties file, which we will go over in next section.  This can be very tedious if you decided that you wanted to support dozens of languages.  You would have to install and edit dozens of property files.  Of course, an easy solution to this is to obtain a font set that contains multiple language support; one of which is the Arial Unicode MS font.  Unfortunately Microsoft no longer supplies this font free-of-charge.  You will either have to purchase it or find an alternative Unicode font set.

Now with the new fonts installed go to home directory of the Sun Wireless ToolKit, and go into the directory wtkdevices.  Now copy DefaultColorPhone and paste in the same directory renamed to UnicodePhone.  Also, rename the properties file under the UnicodePhone directory to UnicodePhone.properties.  Next, using any editor open the UnicdoePhone.properties file and find the font section.  It should look similar to the following:

font.default=SansSerif-plain-10
font.softButton=SansSerif-plain-11

font.system.plain.small: SansSerif-plain-9
font.system.plain.medium: SansSerif-plain-11
font.system.plain.large: SansSerif-plain-14

font.system.bold.small: SansSerif-bold-9
font.system.bold.medium: SansSerif-bold-11
font.system.bold.large: SansSerif-bold-14

font.system.italic.small: SansSerif-italic-9
font.system.italic.medium: SansSerif-italic-11
font.system.italic.large: SansSerif-italic-14

font.system.bold.italic.small: SansSerif-bolditalic-9
font.system.bold.italic.medium: SansSerif-bolditalic-11
font.system.bold.italic.large: SansSerif-bolditalic-14

font.monospace.plain.small: Monospaced-plain-9
font.monospace.plain.medium: Monospaced-plain-11
font.monospace.plain.large: Monospaced-plain-14

font.monospace.bold.small: Monospaced-bold-9
font.monospace.bold.medium: Monospaced-bold-11
font.monospace.bold.large: Monospaced-bold-14

font.monospace.italic.small: Monospaced-italic-9
font.monospace.italic.medium: Monospaced-italic-11
font.monospace.italic.large: Monospaced-italic-14
.
.
Continued

Replace SansSerif and Monospaced with the following: Arial Unicode MS (assuming you are using the Arial Unicode MS font set).  The file should now look similar to the following:

font.default=Arial Unicode MS-plain-10
font.softButton=Arial Unicode MS-plain-11

font.system.plain.small: Arial Unicode MS-plain-9
font.system.plain.medium: Arial Unicode MS-plain-11
font.system.plain.large: Arial Unicode MS-plain-14

font.system.bold.small: Arial Unicode MS-bold-9
font.system.bold.medium: Arial Unicode MS-bold-11
font.system.bold.large: Arial Unicode MS-bold-14

font.system.italic.small: Arial Unicode MS-italic-9
font.system.italic.medium: Arial Unicode MS-italic-11
font.system.italic.large: Arial Unicode MS-italic-14

font.system.bold.italic.small: Arial Unicode MS-bolditalic-9
font.system.bold.italic.medium: Arial Unicode MS-bolditalic-11
font.system.bold.italic.large: Arial Unicode MS-bolditalic-14

font.monospace.plain.small: Arial Unicode MS-plain-9
font.monospace.plain.medium: Arial Unicode MS-plain-11
font.monospace.plain.large: Arial Unicode MS-plain-14

font.monospace.bold.small: Arial Unicode MS-bold-9
font.monospace.bold.medium: Arial Unicode MS-bold-11
font.monospace.bold.large: Arial Unicode MS-bold-14

font.monospace.italic.small: Arial Unicode MS-italic-9
font.monospace.italic.medium: Arial Unicode MS-italic-11
font.monospace.italic.large: Arial Unicode MS-italic-14

font.monospace.bold.italic.small: Arial Unicode MS-bolditalic-9
font.monospace.bold.italic.medium: Arial Unicode MS-bolditalic-11
font.monospace.bold.italic.large: Arial Unicode MS-bolditalic-14
.
.
Continued

For more detailed installation instructions refer to Qusay H. Mahmoudís excellent tutorial, which is indicated in the reference section of this article.


blog comments powered by Disqus
JAVA ARTICLES

- Java Too Insecure, Says Microsoft Researcher
- Google Beats Oracle in Java Ruling
- Deploying Multiple Java Applets as One
- Deploying Java Applets
- Understanding Deployment Frameworks
- Database Programming in Java Using JDBC
- Extension Interfaces and SAX
- Entities, Handlers and SAX
- Advanced SAX
- Conversions and Java Print Streams
- Formatters and Java Print Streams
- Java Print Streams
- Wildcards, Arrays, and Generics in Java
- Wildcards and Generic Methods in Java
- Finishing the Project: Java Web Development ...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials