Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1660

IconvGNU and IconvFBSD transcoders override application-set locale

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7.0
    • 2.8.0
    • Utilities
    • None
    • any

    Description

      When IconvGNU and IconvFBSD transcoders try to figure out the local code page, they call setlocale with an empty string as a second argument. This results in an implementation-specific action which usually consist of querying a set of environment variables and overriding the current locale with the result. This is obviously wrong since Xerces-C++ has no business changing the default application locale. Out of curiosity I checked how things are done in ICU. I found the following comment in the the source code:

      "Do not call setlocale(LC_*, "")! Using an empty string instead of NULL, will modify the libc behavior."

      I came up with a patch that addresses this issue as well as makes the detection code more robust.

      Attachments

        1. setlocale.patch
          3 kB
          Boris Kolpackov

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            bsk Boris Kolpackov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment