Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-557

UnsupportedEncodingException when opening an ISO-8859-1 XML stream with Turkish as the default locale

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.6
    • 2.7
    • Streams/Writers
    • JVM running with argument -Duser.language=tr, or on an Operating System with Turkish as its preferred language.

    Description

      When the default locale is set to the Turkish language, using the XmlStreamReader constructor on an XML stream with a prolog including the ISO-8859-1 charset name in lowercase as its encoding throws a UnsupportedEncodingException (java.io.UnsupportedEncodingException: ─░SO-8859-1).
      Example XML prolog : <?xml version="1.0" encoding="iso-8859-1"?>

      This is apparently because the XmlStreamReader class uses String.toUpperCase() in its getXmlProlog() function. It should rather use toUpperCase(Locale.ROOT) or toUpperCase(Locale.US) as already done in the getContentTypeEncoding() function. Otherwise the behaviour can be different depending on the default locale, as the dotted lower case i becomes a dotted upper case i in the Turkish language, which not the case with other languages.

      Attachments

        Issue Links

          Activity

            People

              pascalschumacher Pascal Schumacher
              luccioman luccioman
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: