Hello A.J.Mechelynck,
Thursday, November 30, 2006, 1:15:14 PM, you wrote:
>?A.J.Mechelynck wrote:
>>?mbbill wrote:
>>>?I met a very strange problem recently, that is
>>>?when I set the following options:
>>>?set encoding=utf-8
>>>?set ignorecase
>>>?then the expression: if "\xe4"=="\xe4" fails.
>>>?I test it using:
>>>?if "\xe4"=="\xe4"
>>>? echo "test"
>>>?endif
>>>?but I got nothing output, why ?
>>>?
>>?I confirm this:
>>? :echo ("\xe4" == "\xe4")
>>?outputs 0
>>?I guess the strings, or at least one of them, are not evaluated as "the
>>?U+00E4 codepoint, i.e., 0xC3 0xA4" but as "the one-byte string 0xE4,
>>?which is not a valid Unicode codepoint when followed by a null". The
>>?latter would be NaS (Not a String) in evaluations, and give the same
>>?kind of strange results as NaN (Not a Number) in floating-point
>>?comparisons.
>>?This conjecture seems to be confirmed by
>>? :echo ("\xe4")
>>?which outputs <e4> in blue, not ä (a-umlaut) in black, which is output by
>>? :echo "ä"
>>?and by
>>? :echo ("\<Char-0xe4>")
>>?Bug or feature?
>>?Best regards,
>>?Tony.
>?P.S.
>? :echo ("ä" == "\xc3\xa4")
>?outputs 1 (one, i.e., TRUE). I think this proves my conjecture above.
Yes, I agree with your opinion.
When I test it somewhere else, I can not let the "bug" come again sometimes,
may be some other options can affect the result of the expression.
--
Best regards,
mbbill mailto:[EMAIL PROTECTED]