You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stefan Bodewig <bo...@apache.org> on 2010/02/12 15:49:22 UTC

[compress] equalsIgnoreCase in Factories (was Re: New release soon?)

On 2010-02-12, Torsten Curdt <tc...@apache.org> wrote:

> I also wanted to get Compressor detection in ...and just committed that :)

Saw that.  While looking through the patch I realized we are using
equalsIgnoreCase in the factories which is not such a good idea since
this is locale dependent and the Turkish lowercase of "ZIP" is not
"zip".  I'll change that to locale insensitive comparisons - actually
comparisons using the English locale soon.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [compress] equalsIgnoreCase in Factories

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-02-12, Torsten Curdt <tc...@apache.org> wrote:

>> While looking through the patch I realized we are using
>> equalsIgnoreCase in the factories which is not such a good idea since
>> this is locale dependent and the Turkish lowercase of "ZIP" is not
>> "zip".

> Wow, didn't know that!

It's been burnt into my brain even since Ant's <fileset> wouldn't work
in Turkish locales - fond memories of a bug fixed more than nine years
ago 8-)

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [compress] equalsIgnoreCase in Factories (was Re: New release soon?)

Posted by Torsten Curdt <tc...@apache.org>.
> Saw that.  While looking through the patch I realized we are using
> equalsIgnoreCase in the factories which is not such a good idea since
> this is locale dependent and the Turkish lowercase of "ZIP" is not
> "zip".

Wow, didn't know that!

I found the comment here quite interesting

 http://nikolajlindberg.blogspot.com/2008/03/beware-of-java-comparing-turkish.html

Seems we can easily fix this with toLowerCase(Locale.US) in this case.
As a side note: For more serious comparisons it seems like a
"Collator" is the right thing to use

 http://java.sun.com/j2se/1.4.2/docs/api/java/text/Collator.html

Never came across that class before :) Interesting!

>  I'll change that to locale insensitive comparisons - actually
> comparisons using the English locale soon.

Yeah, we should fix that before the next release as well.

cheers
--
Torsten

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org