participate


Internationalization (I18N) - Why no font.properties.zh_HK?
<<   Back to Forum  |   Give us Feedback Topics: « Previous | Next
This topic has 9 replies on 1 page.
jbisotti
Posts:356
Registered: 5/28/02
Why no font.properties.zh_HK?   
Jul 22, 2004 2:06 PM

 
In my JRE (1.4.1_06)'s lib directory, there is a font.properties.zh file (for S. Chinese) and a font.properties.zh_TW file (for Taiwan T. Chinese), but no font.properties.zh_HK file (for Hong Kong T. Chinese). Anybody have any idea why?

Also, does anyone know if it is legal to copy font.properties.zh_TW to font.properties.zh_HK and redistribute it?

The reason I'm asking: On an English XP box, with the appropriate fonts installed, if I set user.language to zh or zh_TW, the app starts up and displays fine. However, if I use zh_HK I see a bunch of boxes instead of T. Chinese. Once I make the file copy I mentioned above, all is well. Seems odd that file is not included by default.

Thanks in advance for any insight.

Jamie
 
nuobei
Posts:14
Registered: 2/8/99
Re: Why no font.properties.zh_HK?   
Jul 23, 2004 12:10 PM (reply 1 of 9)  (In reply to original post )

 
JRE 1.4.1 and higher support font rendering for Hong Kong with the MS950_HKSCS (Hong Kong Supplementary Character Set) encoding. You need to install the Windows HKSCS support from http://www.microsoft.com/hk/hkscs/default.aspx.
 
jbisotti
Posts:356
Registered: 5/28/02
Re: Why no font.properties.zh_HK?   
Jul 26, 2004 10:14 AM (reply 2 of 9)  (In reply to #1 )

 
I'm not sure what you descibe is my problem. We use the same resources for both TW and HK. During the build, label_zh_HK.properties gets copied to label_zh_TW.properties. Then, native2ascii is used on them with encodings of GBK and Big5, respectively. Now, in WinXP, I go to "Regional and Language Options", on the "Regional Options" tab, in the "Standards and formats" section, and choose "Chinese (Taiwan)". I start my app and I can see the Chinese characters just fine. If I repeat the process and choose "Chinese (Hong Kong S.A.R.)" I see garbage characters instead of Chinese.

1. I want the Chinese characters to display on my English WinXP box, for occasional testing purposes. The warnings on the MS link provided above make it sound unadvisable to install HKSCS support for this purpose.
2. I want the Chinese characters to display on native Chinese versions of Windows.
3. I want the Chinese characters to display on the other OSes, English and native, our app supports.
4. Where can I find info from Sun about JRE 1.4.1 using MS950_HKSCS for Hong Kong?

I look foward to further comments/thoughts/suggestions.

Jamie
 
nuobei
Posts:14
Registered: 2/8/99
Re: Why no font.properties.zh_HK?   
Jul 27, 2004 12:03 AM (reply 3 of 9)  (In reply to #2 )

 
You probably have problems with both character encoding and font rendering.

The character encoding part: If you use the same resources for TW and HK, you can't use GBK and Big5 conversions on them. GBK and Big5 are incompatible encodings. Also, GBK is for simplified Chinese, and used in mainland China and in Singapore, but rarely in Hong Kong - it doesn't have all the traditional Chinese characters that are used in Hong Kong.

What you get from the translator may be encoded in Big5, or it may already be in ISO-8859-1 with Unicode escapes, the only encoding that the Properties class understands. If it's in Big5, use native2ascii to convert it. If it's ISO-8859-1 with Unicode escapes, leave it alone.

The font rendering part: With Chinese (Taiwan) selected, the font.properties lookup (http://java.sun.com/j2se/1.4.2/docs/guide/intl/fontprop.html#loading ) uses the locale zh_TW and the encoding MS950, and finds font.properties.zh_TW. With Chinese (Hong Kong) it uses the locale zh_HK and the encoding MS950, and finds font.properties.zh. The zh file is for simplified Chinese, so you'll be able to render some, but not all of the Chinese characters used in Hong Kong. If you have HKSCS installed, the lookup uses zh_HK and MS950_HKSCS, and finds font.properties.MS950_HKSCS, which uses fonts appropriate for Hong Kong.

Your questions:

1. I don't know why the warnings are so strong. The only reason given is that "the package may affect private use characters", which could be a serious problem for somebody who seriously uses Chinese, but won't impact your occasional testing. You may want to check with Microsoft.

2. That's what the support in JRE 1.4.1 and up is designed for. The only problem is that the font.properties files aren't consistently named - some are named using locale IDs, others using encoding names, with the results described above.

3. To render Chinese characters in non-Chinese environments, you should upgrade to JRE 5.0 - its multilingual font rendering support uses fonts for all writing systems that it can find on the OS (http://java.sun.com/j2se/1.5.0/docs/guide/intl/enhancements.html#desktop ). With JRE 1.4.1 or 1.4.2, you'd have to look for Chinese fonts yourself and request them using their physical font names. For more information, see http://java.sun.com/j2se/corejava/intl/reference/faqs/index.html#desktop-rendering.

4. JRE 1.4.1 is no longer supported, so info is hard to find. The documentation for JRE 1.4.2 mentions "HKSCS" at http://java.sun.com/j2se/1.4.2/docs/guide/intl/locale.doc.html#jfc. I admit, that's not too clear. A bit more helpful is the name of the font.properties.MS950_HKSCS file. Finally, this reply is info from Sun.

Norbert
 
jbisotti
Posts:356
Registered: 5/28/02
Re: Why no font.properties.zh_HK?   
Jul 27, 2004 11:41 AM (reply 4 of 9)  (In reply to #3 )

 
Thanks for taking the time to help me with this; I really appreciate it. A couple of more items...

Sorry I wasn't completely clear before. We support S. Chinese (Label_zh.properties), TW T. Chinese (Label_zh_TW.properties) and HK T. Chinese (Label_zh_HK.properties). Label_zh_HK.properties is just a copy of Label_zh_TW.properties. When running them through native2ascii, we use GBK for Simplified and Big5 for the two Traditional. If I understood you correctly, there is nothing wrong with any of that?

If I install the MS HKSCS patch on my English XP box, the JRE will use font.properties.MS950_HKSCS (which is why there isn't a font.properties.zh_HK; that is kind of it, it's just named strangely). Native Chinese XP boxes don't need the patch, correct?

Another question: Even when most of my Swing components show Chinese text (Simplified or Traditional) properly, the title bar of the dialog/frame still contains garbage. Any idea why that is? Will upgrading to 5.0 fix this?

Thanks again,
Jamie
 
nuobei
Posts:14
Registered: 2/8/99
Re: Why no font.properties.zh_HK?   
Jul 30, 2004 2:30 PM (reply 5 of 9)  (In reply to #4 )

 
You really need to check with the providers of the localized files which encodings they use, but GBK for simplified Chinese and Big5 for traditional are common choices.

I'm not sure whether you'd find the HKSCS patch preinstalled on machines sold in Hong Kong - I could imagine some manufacturers doing it, others not. Is anybody from Hong Kong listening?

Window titles are drawn by Windows, and in releases before 5.0 AWT used the old ANSI APIs to pass the title to Windows, which could result in data corruption. In 5.0 we use the newer Unicode APIs, so this problem should no longer occur.

Norbert
 
jbisotti
Posts:356
Registered: 5/28/02
Re: Why no font.properties.zh_HK?   
Sep 17, 2004 7:25 AM (reply 6 of 9)  (In reply to #5 )

 
For completeness: http://forum.java.sun.com/thread.jsp?forum=16&thread=545451&tstart=45&trange=15
 
kelvinfung
Posts:5
Registered: 12/27/04
Re: Why no font.properties.zh_HK?   
May 31, 2005 3:51 AM (reply 7 of 9)  (In reply to #6 )

 
Hi All,

I am a Hong Kong developer while I have a question about displaying HKSCS in Java.

I know that I need to make the VM to use font.properties.zh_TW_MS950_HKSCS so that HKSCS can be handled properly by the VM, right? In fact, what we are talking about is to make the VM to load an appropriate font file.

However, I can think of a easy way to do this, is there any suggestion?

In fact, I have installed the HKSCS pack with the windows locale set to "Chinese Hong Kong S.A.R.". However, the VM still load font.properties.zh_TW instead of font.properties.zh_TW_MS950_HKSCS.

The VM I am using is Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28) while the O/S I am using is Windows XP SP1 English.
 
kelvinfung
Posts:5
Registered: 12/27/04
Re: Why no font.properties.zh_HK?   
May 31, 2005 11:02 PM (reply 8 of 9)  (In reply to #7 )

 
Hi All,

I got the answer after reading once again all above post. Just need to install the MS HKSCS and set the Windows Locale to "Hong Kong", everything works fine and HKSCS can be displayed properly.
 
cannon_dt
Posts:1
Registered: 6/2/08
Re: Why no font.properties.zh_HK?   
Jun 2, 2008 4:18 AM (reply 9 of 9)  (In reply to #8 )

 
Hi,
I know this thread has not had activity for some time now but i am still facing issues with HKSCS and I need help.

I have installed HKSCS support but still Chinese characters are not being displayed (I see blanks). I dont think this is an encoding issue because the same screen under Microsoft VM shows the Chinese characters. In fact, only after I installed the hkscs support did these characters stop being displayed. I also tried setting the locale to Hong Kong and I am using the Ming Liu font as well.

Can anyone help out?

Thanks,
Ananth
 
This topic has 9 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 29
  • Guests : 132

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums