[Mono-dev] System.dll few patches for review
Atsushi Eno
atsushi at ximian.com
Fri Oct 6 07:54:17 EDT 2006
Because there are characters that are ignored even in invariant comparison.
Well, I agree that "instead" was not proper here. It should be
"additionally".
Atsushi Eno
Andreas Nahr wrote:
> Care to explain why? I'm aware that Invariant will be
> (invariant-culture) sensitive, however it IMHO would fix the bug.
> I also agree that using String.Compare with OrdinalIgnoreCase would be
> the best option, however unfortunatelly that is .Net 2.0 only.
>
> String.CompareOrdinal() is obviously obviously a no-go because it would
> be case-sensitive and as I already wrote CompareOptions are 2.0 only.
>
> Happy hacking
> Andreas
>
> P.S.
> If I'd design a new .Net Framework the first thing would be to create
> two Classes: (System)String and LanguageString.
>
>
>> You are still wrong :-) InvariantCulture still causes culture
>> sensitive comparison.
>>
>> Use String.CompareOrdinal() or CompareOptions.Ordinal instead.
>>
>> Atsushi Eno
>>
>> Andreas Nahr wrote:
>>> Sorry if this is already handled, just looked over the list and found
>>> this
>>> bug:
>>>
>>>>> Index: System.Net/DigestClient.cs
>>>>> ===================================================================
>>>>> --- System.Net/DigestClient.cs (revision 66034)
>>>>> +++ System.Net/DigestClient.cs (working copy)
>>>>> @@ -248,9 +248,9 @@
>>>>> return false;
>>>>> }
>>>>>
>>>>> - // build the hash object (only MD5 is defined in RFC2617)
>>>>> - if ((parser.Algorithm == null) || (parser.Algorithm.ToUpper
>>>>> ().StartsWith ("MD5")))
>>>>> - hash = HashAlgorithm.Create ("MD5");
>>>>> + // build the hash object (only MD5 is defined in RFC2617)
>>>>> + if ((parser.Algorithm == null) || (parser.Algorithm.ToUpper
>>>>> ().StartsWith ("MD5")))
>>>>> + hash = MD5.Create ();
>>>>>
>>>>> return true;
>>>>> }
>>>
>>> Algorithm.ToUpper ().StartsWith ("MD5"))) is most likely wrong
>>> because the
>>> code is doing a culture-sensitive uppercasing.
>>> You should use something like ToUpperInvariant or pass the Invariant
>>> Culture
>>> (or better if possible: one of the case-insensitive compares)
>>>
>>> I didn't look into the relevant classes, but there may be more similar
>>> occurences of that problem.
>>>
>>> mfg
>>> Andreas
>>>
>>> _______________________________________________
>>> Mono-devel-list mailing list
>>> Mono-devel-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
>
>
More information about the Mono-devel-list
mailing list