control: reopen -1
control: severity -1 normal
control: retitle -1 gbp import-orig fails on Umlauts with non-utf8 locale

Hi,
On Mon, Nov 06, 2017 at 03:37:49PM +0100, Guido Günther wrote:
> Hi,
> On Mon, Nov 06, 2017 at 02:28:33PM +0000, Nico Schlömer wrote:
> > Digging further, I found that the error can be fixed with
> > ```
> > io.open(self.filename, mode='r', encoding='utf-8')
> > ```
> > in `_read`, just as described in [1]. Note that
> > ```
> > self._contents.encode()
> > ```
> > needs to become
> > ```
> > self._contents.encode('utf-8')
> > ```
> > then, too.
> 
> Thanks for looking deeper but please lets first try to understand where
> the bug comes from before tryng to apply 'fixes" from
> stackoverflow. Which locale are you running inder?

This reproduces it:

    $ LC_ALL=C gbp import-orig --uscan
gbp:info: Launching uscan...
uscan: Newest version of gmsh on remote site is 3.0.6, local version is 
3.0.5+dfsg1
 (mangled local version is 3.0.5)
uscan:    => Newer package available from
      http://www.geuz.org/gmsh/src/gmsh-3.0.6-source.tgz
gbp:info: Using uscan downloaded tarball ../gmsh_3.0.6+dfsg1.orig.tar.gz
Traceback (most recent call last):
  File "/usr/bin/gbp", line 151, in <module>
    sys.exit(supercommand())
  File "/usr/bin/gbp", line 147, in supercommand
    return module.main(args)
  File "/usr/lib/python3/dist-packages/gbp/scripts/import_orig.py", line 550, 
in main
    (sourcepackage, version) = detect_name_and_version(repo, upstream, options)
  File "/usr/lib/python3/dist-packages/gbp/scripts/import_orig.py", line 230, 
in detect_name_and_version
    cp = ChangeLog(filename='debian/changelog')
  File "/usr/lib/python3/dist-packages/gbp/deb/changelog.py", line 91, in 
__init__
    self._read()
  File "/usr/lib/python3/dist-packages/gbp/deb/changelog.py", line 128, in _read
    self._contents = f.read()
  File "/usr/lib/python3.6/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 399: 
ordinal not in range(128)

Reply via email to