[vlc-devel] [PATCH 1/2] lua: add a guess_encoding function to convert Latin1 to UTF8

Ludovic Fauvet etix at videolan.org
Wed Aug 28 15:08:36 CEST 2013


On 08/27/2013 05:40 PM, Rémi Denis-Courmont wrote:
> Le mardi 27 août 2013 16:43:53 Ludovic Fauvet a écrit :
>> On 08/27/2013 04:27 PM, Rémi Denis-Courmont wrote:
>>> On Tue, 27 Aug 2013 16:14:55 +0200, Ludovic Fauvet <etix at videolan.org>
>>>
>>> wrote:
>>>>> That's not true. It returns an empty string on error, which is clearly
>>>>> different from success. Feel free to change it to return a proper error
>>>>> or nil.
>>>>
>>>> Sorry but you're wrong.
>>>
>>> No. You are. You can RTFS if you do not believe me.
>>
>> You should be kidding! Right?
> 
> Not unless someone hacked my vlc.git trees on two different matchines.
> 
>>>> Using the following piece of code:
>>>> src = vlc.strings.from_charset("ISO_8859-1", src)
>>>>
>>>> and the following UTF8 encoded input string:
>>>> Le Lac des Cygnes (Piotr Ilitch Tchaïkovsky)
>>>>
>>>> It gives me the following result:
>>>> Le Lac des Cygnes (Piotr Ilitch Tchaïkovsky)
>>>
>>> Yes, and so what?
>>
>> You don't see what's wrong with it? Because I do.
> 
> I see what's wrong with your code above, and what's wrong with the result.
> 
> I don't see anything wrong with "my solution" (dixit JB) though.
> 
>>>> Where's my empty string?
>>
>>> There was no error, and there is no empty string. This is irrelevant.
>>
>> This review is a complete nonsense.
> 
> Oh really?
> 
>     const char *src = "Piotr Ilitch Tcha\xefkovsky";
> 
>     FromCharset("UTF-8", src, strlen(src)) == NULL
>     strcmp(FromCharset("ISO-8859-1", src, strlen(src)),
>            "Piotr Ilitch Tchaïkovsky") == 0;
> 
> Which naturally gives us an implementation of IsUTF8() with FromCharset():
> (Note: error cases and garbage collection left out for simplicity.)
> 
> static inline bool IsUTF8(const char *str);
> {
>     return *str ? (FromCharset("UTF-8", str, strlen(str)) != NULL) : true;
> }
> 
> And in Lua, surprise surprise, the same coding logic works with the empty 
> string instead of NULL.
> 
>> Can't you just admit that your assumptions were wrong so we can actually
>> move forward and find the *best* way to fix this issue or are you going to
>> continue arguing that there is no issue?
> 
> Offense taken.
> 

My goal was not to be rude, you have to understand that I totally trust
your decisions when they are explicit and explained. As a proof, you're
the only one I asked privately on IRC to review the patch but because I
did not understand your points I had to send it over the mailing list or
just let it die without understanding the reasons behind the rejection.

I think that most technical decisions you take are good, even if I
sometimes like to complain about them, but still I understand why you
took them. That said, I think you lack some communication skills and you
should really improve them for the sake of this community.

As of now I will try the solution you suggested.

-- 
Ludovic Fauvet
www.videolan.org



More information about the vlc-devel mailing list