Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-1754

[macOS] locale.getdefaultlocale() fails with default language set to English

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.0
    • Fix Version/s: 4.1.4
    • Component/s: Framework
    • Environment:
      macOS
    • Tags:
    • Sprint:
      nxDrive 11.1.14
    • Story Points:
      1

      Description

      Error

      This is a known issue: bpo-18378:

      nxdrive/engine/tracker.py:46: in __init__
          self._tracker.set("language", self.current_locale)
      nxdrive/engine/tracker.py:69: in current_locale
          encoding = locale.getdefaultlocale()[1] or ""
      ../deploy-dir/.pyenv/versions/3.7.3/lib/python3.7/locale.py:568: in getdefaultlocale
          return _parse_localename(localename)
      
      localename = 'UTF-8'
          def _parse_localename(localename):
              """ Parses the locale code for localename and returns the
                  result as tuple (language code, encoding).
                  The localename is normalized and passed through the locale
                  alias engine. A ValueError is raised in case the locale name
                  cannot be parsed.
                  The language code corresponds to RFC 1766.  code and encoding
                  can be None in case the values cannot be determined or are
                  unknown to this implementation.
              """
              code = normalize(localename)
              if '@' in code:
                  # Deal with locale modifiers
                  code, modifier = code.split('@', 1)
                  if modifier == 'euro' and '.' not in code:
                      # Assume Latin-9 for @euro locales. This is bogus,
                      # since some systems may use other encodings for these
                      # locales. Also, we ignore other modifiers.
                      return code, 'iso-8859-15'
              if '.' in code:
                  return tuple(code.split('.')[:2])
              elif code == 'C':
                  return None, None
      >       raise ValueError('unknown locale: %s' % localename)
      E       ValueError: unknown locale: UTF-8
      

      Action

      • We should contribute a patch upstream.
      • In the meantime, use try...except and use utf-8 by default.

        Attachments

          Activity

            People

            • Assignee:
              mschoentgen Mickaël Schoentgen
              Reporter:
              mschoentgen Mickaël Schoentgen
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 10 minutes
                10m