You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Thomas DeWeese <Th...@Kodak.com> on 2005/09/03 15:00:47 UTC
Re: potential problems with String.toUpper/LowerCase
Hi dvholten,
I'll look into this, clearly this is a bit more involved to
fix, I appreciate your bringing this to our attention.
I've integrated your other bug fixes.
Thanks a lot!
dvholten@computer.org wrote:
> there are lots of calls to toUppercase() and toLowerCase() in the
> batik-code.
> While many of them look innocent, there are potential problems:
> it is recommended coding practice to give a locale-specifer when using
> one of
> these methods. Especially the turkish locale has 'very special'
> conversion for both of
> their 'i'-characters.
> The proposed solution is to introduce a static helper-method, which
> explicitly passes the english locale
> which uses the intended conversion.
>
> While most of batik's conversions may go through, i found one real problem:
> dom/events/DocumentEventSupport line 121
> UI_EVENT_DOM2_TYPE.toLowerCase() ( defined as "UIEvents" )
> will give an unexpected result in a turkish locale.
> Fix: use helper with defined locale.
>
> This problem can come up wherever 'random' uppercase text can be the input.
> I think these places are suspicious:
> dom/svg/SAXSVGDocumentFactory: 169
> contentType = contentType.toLowerCase() // contenttype might be
> 'image/svg+xml; charset=iso8859 like in comment
>
> awt/image/codec/PNGImageDecoder: 467
> properties.put( key.toLowerCase(), ... ) // key contains the
> chunktype, which can be 'tIME'
> there are two more calls in that file, but it is not clear yet, what the
> string might contain there
> Fix: use helper with defined locale.
>
> awt/image/codec/PNGRed: 457 same as above - code duplicated??
> Fix: use helper with defined locale.
>
>
> awt/image/coded/SimpleRenderedImage: 229
> 229: name = name.toLowerCase() // some property-name for lookup,
> can be anything
> 273: prefix = prefix.toLowerCase() // can be anything
> Fix: ???
>
> gvt/font/FontFamilyResolver
> 76: fonts.put( fontNames[i].toLowerCase() ... //
> system-specific, whenever a font-name contains 'I'
> 84: same
> 89: same
> 124: same
> 143: same
> 148; same
> 153: same
> Fix: ???
>
> gvt/font/GVTFontFace
> 103: use of font-names for lookup
> 105: use of font-names for lookup
> Fix: ???
>
> swing/svg/SVGFileFilter
> 43: fileName = f.gethPath().toLowercase() // only filename-extension
> is used, no problem here
>
> util/ParsedURL
> 481: makes problem when url-protocol contains uppercase 'I'
> Fix: use helper with defined locale.
>
> util/ParsedURLDefaultProtocolHandler
> 128: same as above
> 267: same as above
> Fix: use helper with defined locale.
>
> util/EncodingUtilities
> 95: encoding.toUppercase() used to lookup one of defines encodings -
> will fail, when request contains lowercase 'i' in turkey.
> Fix: use helper with defined locale.
>
> util/io/StreamNormalizingReader
> 158: encoding.toUpperCase() used to lookup decoder - will fail, when
> requested encoding contains lowercase 'i' in turkey.
> Fix: use helper with defined locale.
>
>
> Thats all for now. I am not from turkey, but i have done a project there
> a few years ago - and those 4 'i's have bitten me sometimes.
> For further, more detailed information about this topic i refer you to
> http://cafe.elharo.com/java/turkish
>
>
> greetings
> dvholten
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org