function AnsiToUTF and localeToUTF duplicate and conflict

Yung-Jang Lee yjlee123 at gmail.com
Sat Aug 2 18:31:25 CEST 2008


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>

> 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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20080803/f9e008f4/attachment.htm>


More information about the dev mailing list