Article View: borland.public.jbuilder.java.language
Article #7823Re: Retrieving Chinese characters from Properties file
From: Alex
Date: Thu, 17 May 2001 02:31
Date: Thu, 17 May 2001 02:31
67 lines
3398 bytes
3398 bytes
hi cxing, i write a test by your sample code. but i can't show
chinese char.
so now. i have some question:
1. my properties must be unicode file? or UTF8 file?
2.how to show chinese in my java app?
alex
Email: alex@263.net.cn
On Wed, 11 Oct 2000 16:49:33 -0700, "cxing" <cxing@inprise.com> wrote:
>You can write a simple conversion program to escape extended characters.
>Something like this
> static final char[] hexes =
>{'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'} ;
> String escapeString(String src) {
> char[] chars = src.toCharArray() ;
> char[] ud = new char[4] ;
> StringBuffer buff = new StringBuffer();
> for(int i=0;i<chars.length;i++) {
> if(chars[i] > 0x7f) {
> ud[0] = hexes[chars[i] & 0x000f] ;
> ud[1] = hexes[(chars[i] & 0x00f0) >> 4] ;
> ud[2] = hexes[(chars[i] & 0x0f00) >> 8] ;
> ud[3] = hexes[(chars[i] & 0xf000) >> 12] ;
> buff.append("\\U") ;
> buff.append(ud[3]) ;
> buff.append(ud[2]) ;
> buff.append(ud[1]) ;
> buff.append(ud[0]) ;
> }else {
> buff.append(chars[i]) ;
> }
> }
> return buff.toString() ;
> }
>
>Chris Xing
>International R&D Engineer
>JBuilder Team
>Borland/Inprise
>
>"Sheilagh Bill" <SheilaghB@impro.co.za> wrote in message
>news:39E31095.A34AC6BF@impro.co.za...
>> Hi
>>
>> My application allows dynamic translation of resource strings from the
>> screen, stores them to a resource properties file. A user can then
>> select a locale (hence the relevant properties file) for display. This
>> works correctly for Latin 1 encoding.
>>
>> In a Chinese Windows O/S the characters can be captured and written to
>> the file and appear correct when viewed with Notepad or Wordpad.
>> However when the getString method of the ResourceBundle is used to
>> retrieve the resource strings the characters are changed. Looking at
>> Borlands sample multi-lingual program I notice that all characters above
>> ASCII 127 are entered as a unicode escape sequence. This reads back
>> correctly but is this required? I have tried writing the file with
>> JavaOutputStreamWriter and EncodedOutputStream but the Chinese
>> characters are still not written out as unicode escape sequences.
>>
>> Please can anyone help, I don't know where to look anymore.
>> Thanks
>>
>> Sheilagh Bill
>
Technical Details
Message-ID:
<47d6gtklno6cscin0pi7a8k3ajqn4tu8tt@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!news-out.visi.com!hermes.visi.com!news.tele.dk!193.251.151.101!opentransit.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<39E31095.A34AC6BF@impro.co.za> <8s2tgl$mer17@bornews.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,b0148acea17952b4,start X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-05-16 19:42:04 PST From: Alex <zzling@21cn.com> Newsgroups: borland.public.jbuilder.java.language Subject: Re: Retrieving Chinese characters from Properties file Date: Thu, 17 May 2001 10:31:21 +0800 Message-ID: <47d6gtklno6cscin0pi7a8k3ajqn4tu8tt@4ax.com> References: <39E31095.A34AC6BF@impro.co.za> <8s2tgl$mer17@bornews.borland.com> X-Newsreader: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 202.106.252.217 X-Trace: dnews 990066700 202.106.252.217 (16 May 2001 19:31:40 -0700) Lines: 68 Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!news-out.visi.com!hermes.visi.com!news.tele.dk!193.251.151.101!opentransit.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnews