[Scilab-Dev] Test report of Chinese (or multibytes languages in general) locale mesages with Scilab 5-beta-1
Yung-Jang Lee
yjlee123 at gmail.com
Tue Jun 3 14:33:17 CEST 2008
Sorry,
The files I send have two bugs due to copy and paste mistake,
----------localetoutf.c-----------------------------------
BOOL openLocaleToUTFConverter(char *sysLocale,char *lang)
{
// Assume sysLocale in lang_contry.charset or lang_contry format
//
// Ex. en_US, zh_TW.CP950, zh_CN.UTF-8
//
char encoding[5];
char * pch=strchr ( sysLocale, '.');//<-------------------------------
this line missing
if(pch){
-----------------------------------------------------------------
and
--------------------getLocaleInfo_Windows.c-----------------------------
// BY YJLee get Windows CODE Page Information\ <---- should
delete last character
int ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_IDEFAULTANSICODEPAGE,
-----------------------------------------------------------------------
Please check it.
YungLee
2008/6/2 Yung-Jang Lee <yjlee123 at gmail.com>:
> Sylvestre,
>
> Enclosed is my small patch for Java console to display chinese characters
> and the result PNG screenshot.
>
> The test in under Windows XP, with BIG5 encoding (Windows CodePage 950).
>
> This test confirm that it need a locale to utf-8 convert before send string
> to Java console for locale not compatible with UNICODE.
>
> The patch contains following files
>
>
> 1. localization\src\c : localetoutf.h, localetoutf.c
> provide functions
> void localeToUTF(char** buffer) <--- doing locale to utf convert
> openLocaleToUTFConverter(char *sysLocale,char *lang) <--- open or
> close converter
> This two functions calls functions from iconv library which is
> contained in Scilab5 prerequreiment.
>
> 2. localization\src\c : setlanguage.c,
> add a line to call openLocaleToUTFConverter ,
>
> 3. localization\src\c : getLocaleInfo_Windows.c,
> modified return value of getLocaleUserInfo in lang_contry.codepage
> format t,codepage information is used inside openLocaleToUTFConverter
>
> 4. console\src\cpp: consolePrint.c :
> add a line to call localeToUTF
>
>
> This is just a small patch to test locale to utf encoding concept, it need
> further enhancement.
>
> I have two questions. First , in my chinese Java console , the menu items
> are disabled ( unlike your Linux case) is this a bug under Windows ?
> Second, menu items are displayed in chinese under Linux but in english
> under Windows, what make them different ?
>
>
> YungLee
>
> 2008/5/30 Yung-Jang Lee <yjlee123 at gmail.com>:
>
> Sylvestre:
>>
>> Let me try. Give me a week.
>>
>> YungLee
>>
>> 2008/5/30 Sylvestre Ledru <sylvestre.ledru at inria.fr>:
>>
>>
>>> > To solve this problem, we must decide locale setting in runtime and
>>> > transform characters back to UTF8 if the locale setting is not
>>> > in UTF8.
>>> OK, then, a way of doing this could be:
>>> * if the LANG/LC_MESSAGES/whatever variable says that the language is
>>> UTF-8, don't do anything.
>>> * if not, convert it
>>> However, that sounds like a workaround to me, not a really bug fix.
>>> There must be a way to deal with this.
>>>
>>> > Hope these can help.
>>> It does!
>>>
>>> S
>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20080603/2749c856/attachment.htm>
More information about the dev
mailing list