← Back to team overview

group.of.nepali.translators team mailing list archive

[Bug 1733553] Re: python3-babel requires UTF-8 locale

 

I think this is resolved in newer babel versions by this commit:

  https://github.com/python-
babel/babel/commit/514d41c0e73c58d43ace3ec310585bc48775196a

which switches the read of files to binary mode, rather than dealing
with the encoding of input files.  Under py2 well, erm, it just works
for 1.3.

** Changed in: python-babel (Ubuntu)
       Status: New => Fix Released

** Also affects: python-babel (Ubuntu Xenial)
   Importance: Undecided
       Status: New

** Changed in: python-babel (Ubuntu Xenial)
       Status: New => Triaged

** Changed in: python-babel (Ubuntu Xenial)
   Importance: Undecided => Low

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1733553

Title:
  python3-babel requires UTF-8 locale

Status in python-babel package in Ubuntu:
  Fix Released
Status in python-babel source package in Xenial:
  Triaged

Bug description:
  babel throws an exception when compiling a PO file with non-ascii
  characters unless locale is set to some with UTF-8 encoding.

  Example when compiling django-filter language catalogs:

  $ echo $LC_ALL
  C
  $ python3 setup.py compile_catalog --directory django_filters/locale/ --locale es_AR --domain django
  running compile_catalog
  Traceback (most recent call last):
    File "setup.py", line 60, in <module>
      zip_safe=False,
    File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/lib/python3/dist-packages/babel/messages/frontend.py", line 134, in run
      catalog = read_po(infile, locale)
    File "/usr/lib/python3/dist-packages/babel/messages/pofile.py", line 205, in read_po
      for lineno, line in enumerate(fileobj.readlines()):
    File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
      return codecs.ascii_decode(input, self.errors)[0]
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 681: ordinal not in range(128)

  With UTF-8 locale:

  $ LC_ALL=C.UTF-8 python3 setup.py compile_catalog --directory django_filters/locale/ --locale es_AR --domain django
  running compile_catalog
  compiling catalog 'django_filters/locale/es_AR/LC_MESSAGES/django.po' to 'django_filters/locale/es_AR/LC_MESSAGES/django.mo'

  The PO file has an encoding defined, so babel should not strictly
  needed it specified in LC_ALL, I think:

  ...
  "Content-Type: text/plain; charset=UTF-8\n"
  "Content-Transfer-Encoding: 8bit\n"
  ...
  #: filters.py:51
  msgid "This is an exclusion filter"
  msgstr "Este es un filtro de exclusión"

  
  (The bug does not manfest with python-babel package)

  python3-babel: 1.3+dfsg.1-6
  Ubuntu 16.04.2 LTS (in a pbuilder-cowbuilder VM)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-babel/+bug/1733553/+subscriptions