[vlc-devel] [PATCH 1/4] Treat UTF-16 as UCS-2 on OS/2

Rafaël Carré funman at videolan.org
Fri Feb 17 09:54:46 CET 2012


Le 12-02-14 09:25, KO Myung-Hun a écrit :
> 
> 
> KO Myung-Hun wrote:
>>
>>
>> KO Myung-Hun wrote:
>>>
>>>
>>> Rémi Denis-Courmont wrote:
>>>> Le lundi 16 janvier 2012 04:26:33 KO Myung-Hun, vous avez écrit :
>>>>> KO Myung-Hun wrote:
>>>>>> OS/2 supports UCS-2 only instead of UTF-16.
>>>>>> ---
>>>>>>
>>>>>>  src/extras/libc.c |   17 +++++++++++++++++
>>>>>>  1 files changed, 17 insertions(+), 0 deletions(-)
>>>>>>
>>>>>> diff --git a/src/extras/libc.c b/src/extras/libc.c
>>>>>> index 6df1a52..08b19fc 100644
>>>>>> --- a/src/extras/libc.c
>>>>>> +++ b/src/extras/libc.c
>>>>>> @@ -326,6 +326,23 @@ vlc_iconv_t vlc_iconv_open( const char *tocode,
>>>>>> const char *fromcode )
>>>>>>
>>>>>>          return (vlc_iconv_t)(-2);
>>>>>>  
>>>>>>  #endif
>>>>>>  #if defined(HAVE_ICONV)
>>>>>>
>>>>>> +# if defined(__OS2__) && defined(__INNOTEK_LIBC__)
>>>>>> +    char tocode_ucs2[] = "UCS-2LE";
>>>>>> +    char fromcode_ucs2[] = "UCS-2LE";
>>>>>> +
>>>>>> +    /* Workaround for UTF-16 because OS/2 supports UCS-2 only not UTF-16
>>>>>> */ +    if( !strncmp( tocode, "UTF-16", 6 ))
>>>>>> +    {
>>>>>> +        strncpy( tocode_ucs2 + 5, tocode + 6, 2 );
>>>>>> +        tocode = tocode_ucs2;
>>>>>> +    }
>>>>>> +
>>>>>> +    if( !strncmp( fromcode, "UTF-16", 6 ))
>>>>>> +    {
>>>>>> +        strncpy( fromcode_ucs2 + 5, fromcode + 6, 2 );
>>>>>> +        fromcode = fromcode_ucs2;
>>>>>> +    }
>>>>>> +# endif
>>>>>>
>>>>>>      return iconv_open( tocode, fromcode );
>>>>>>  
>>>>>>  #else
>>>>>>  
>>>>>>      return (vlc_iconv_t)(-1);
>>>>>
>>>>> Ping ?
>>>>
>>>> I'm not sure if this will work correctly. While technically, they are two 
>>>> names for the same specification, UCS-2 and UTF-16 usually mean different 
>>>> things. UCS-2 is usually limited to the Basic Multilingual Plane of Unicode, 
>>>> while UTF-16 is not.
>>>>
>>>
>>> Yes, you're right.
>>>
>>> But iconv() of OS/2 kLIBC does not support UTF-16. So I think it would
>>> be better to support UCS-2 at least than nothing.
>>>
>>> I know, UTF-16 is a kind of a superset of UCS-2. So only some codes
>>> needing surrogates are converted incorectly in this method.
>>>
>>> Anyway, this is a limitation of OS/2 Unicode APIs.
>>>
>>
>> Ping ?
> 
> Ping, again ?

Sorry for the delay, both patches applied on 2.1.

Is backporting those 2 patches to 2.0 enough to have VLC working on OS/2 ?

I don't know how distributing apps work for OS/2 but perhaps we could
have a 2.0.0 binary available for download on videolan.org



More information about the vlc-devel mailing list