[Scilab-Dev] Re: function AnsiToUTF and localeToUTF duplicate and conflict

François Vogel fvogelnew1 at free.fr
Sat Aug 9 18:32:50 CEST 2008


Hi,

I have also noticed there seem to be some duplicates here and there.

And more than what you're reporting: in ScilabEval.c for instance, 
conversion from UTF-8 to ANSI is performed by a function from the Tcl 
librayr (Tcl_UtfToExternal).

Cleaning and standardization is needed, but maybe I'm coming after 
things were done (your message is more than a week old)?

Francois


Yung-Jang Lee said on 02/08/2008 18:31:
> Hi,all:
> 
> I have check that the results to call localeToUTF and ANSIToUTF8 are 
> exact the same in my machine. But for CP1252 encoding I don't convert to 
> UTF inside localeToUTF in current implementation (I thought CP1252 is a 
> subset of UNICODE).
> 
> So, may be we can remove calling 'ANSIToUTF8' in 'printf_scilab' and let 
> 'localeToUTF' always perform convert even for CP1252 encoding.
> 
> Or any suggections ?
> 
> YungLee
> 
> 
> 
> 2008/8/2 Yung-Jang Lee <yjlee123 at gmail.com <mailto:yjlee123 at gmail.com>>
> 
>     Hi, all :
> 
>     In recent  SVN trunk, I found a new files
>     windows_tools*\charEncodings.c that have functions for encoding
>     convert and this is conflicted  with function in file
>     locazilation*\localetoutf.c .  Function ANSIToUTF8 (defined in
>     charEncodings.c ) is used  in printf_scilab :
> 
> 
>     -----------------------sciprint.c---------------------------------------
>     void printf_scilab(char *buffer,BOOL withDiary)
>     {
>         if (buffer)
>         {
>             if (getScilabMode() == SCILAB_STD)
>             {
>                 #ifdef _MSC_VER
>                 {
>                     char *UTF8Buffer = ANSIToUTF8(buffer);//<--------
>                     if (UTF8Buffer)
>                     {
>                         ConsolePrintf(UTF8Buffer);   
>     //<------------------------- call localeToUTF inside ConsolePrintf
>                         FREE(UTF8Buffer);
>                     }
>     -------------------------------------------------------------------------------
> 
>     On my machine (WINDOW/XP,CP950) , conversion to UTF strings is thus
>     performed twice, and this make console fail to display chinese again.
> 
>     I think functions in files 'charEncodings.c' and 'localetoutf.c' 
>     should merged and the encoding transformation need some agreements
>     between developers.
> 
>     YungLee
> 
> 
> 



More information about the dev mailing list