On Tue, 1 Nov 2011, Carsten Haitzler (The Rasterman) wrote:

> On Tue, 1 Nov 2011 08:54:47 +0100 (CET) Vincent Torri <[email protected]>
> said:
>
> does that work on wince?

not tested, but it should:

http://msdn.microsoft.com/en-us/library/aa908730.aspx

I can tweak it a bit though, to give a nice error message if it fails 
(both win32 and win ce)

Vincent

>
>>
>> hey
>>
>> about utf16 to utf8 conversion, can you try the function below ? If it
>> works, I commit it.
>>
>> Vincent
>>
>>
>> char *
>> evil_utf16_to_utf8(const wchar_t *text16)
>> {
>>     char  *text8;
>>     DWORD  flag = 0;
>>     int    size8;
>>
>>     if ((!text16) || (*text16 == L'\0'))
>>       return NULL;
>>
>> #if _WIN32_WINNT >= 0x0600
>>     flag = WC_ERR_INVALID_CHARS;;
>> #endif
>>
>>     size8 = WideCharToMultiByte(CP_UTF8, flag, text16, -1, NULL, 0, NULL,
>> NULL); if (size8 == 0)
>>       return NULL;
>>
>>     text8 = (char*)malloc(size8 * sizeof(char));
>>     if (!text8)
>>       return NULL;
>>
>>     size8 = WideCharToMultiByte(CP_UTF8, flag, text16, -1, text8, size8,
>> NULL, NULL); if (size8 == 0)
>>       return NULL;
>>
>>     return text8;
>> }
>>
>> ------------------------------------------------------------------------------
>> RSA&reg; Conference 2012
>> Save &#36;700 by Nov 18
>> Register now
>> http://p.sf.net/sfu/rsa-sfdev2dev1
>> _______________________________________________
>> enlightenment-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>>
>
>
> -- 
> ------------- Codito, ergo sum - "I code, therefore I am" --------------
> The Rasterman (Carsten Haitzler)    [email protected]
>
>

------------------------------------------------------------------------------
RSA&reg; Conference 2012
Save &#36;700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to