annotate - ascii codec can't decode byte

Bug #239412 reported by Ole Dalgaard
2
Affects Status Importance Assigned to Milestone
bzr-xmloutput
Fix Released
High
Guillermo Gonzalez

Bug Description

It seems that 'annotate' has problems with utf-8 characters. Files with no special characters works fine, but when a file includes special charaters 'annotate' fails:

[od@padden test]$ bzr annotate --xml TODO\ Årupvænget.txt
bzr: ERROR: exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 86: ordinal not in range(128)

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 846, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 797, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 499, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 807, in ignore_pipe
    result = func(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/xmloutput/__init__.py", line 129, in run
    wt_root_path=wt_root_path, file_path=relpath)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/xmloutput/annotatexml.py", line 65, in annotate_file_xml
    to_file.write('<entry %s>%s</entry>' % (anno, _escape_cdata(text)))
  File "/usr/lib/python2.5/codecs.py", line 303, in write
    data, consumed = self.encode(object, self.errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 86: ordinal not in range(128)

bzr 1.5 on python 2.5.1 (linux2)
arguments: ['/usr/bin/bzr', 'annotate', '--xml', 'TODO \xc3\x85rupv\xc3\xa6nget.txt']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'
plugins:
  bzrtools /usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [1.5.0]
  gtk /usr/lib/python2.5/site-packages/bzrlib/plugins/gtk [0.94.0]
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
  xmloutput /usr/lib/python2.5/site-packages/bzrlib/plugins/xmloutput [0.4.4]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.
<?xml version="1.0"?><annotation workingtree-root="/home/od/src/test/" file="TODO Årupvænget.txt"><entry revno="1" author="od@padden" date="20080531"></entry><entry revno="6" author="od@padden" date="20080612">Line without special charaters</entry><entry revno="6" <email address hidden>" date="20080612">Another line without special charaters</entry>[od@padden test]$

Related branches

Revision history for this message
Guillermo Gonzalez (verterok) wrote :

Thanks for reporting this.
I'll try to fix it as soon as possible

Changed in bzr-xmloutput:
importance: Undecided → High
status: New → Confirmed
Changed in bzr-xmloutput:
assignee: nobody → guillo.gonzo
status: Confirmed → In Progress
status: In Progress → Fix Committed
Revision history for this message
Ole Dalgaard (ole-d) wrote :

Thanks, it works :-)
... except that it breaks plain annotate (without the --xml)

1 od@padd |
6 ole.d@l | Line without special charaters
            | Another line without special charaters
bzr: ERROR: exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 30: ordinal not in range(128)

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 846, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 797, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 499, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 807, in ignore_pipe
    result = func(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/xmloutput/__init__.py", line 133, in run
    annotate_class.run(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 807, in ignore_pipe
    result = func(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 3518, in run
    show_ids=show_ids)
  File "/usr/lib/python2.5/site-packages/bzrlib/annotate.py", line 109, in annotate_file
    to_file.write('| %s\n' % (text,))
  File "/usr/lib/python2.5/codecs.py", line 303, in write
    data, consumed = self.encode(object, self.errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 30: ordinal not in range(128)

bzr 1.5 on python 2.5.1 (linux2)
arguments: ['/usr/bin/bzr', 'annotate', 'TODO \xc3\x85rupv\xc3\xa6nget.txt']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'
plugins:
  bzrtools /usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [1.5.0]
  gtk /usr/lib/python2.5/site-packages/bzrlib/plugins/gtk [0.94.0]
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
  xmloutput /usr/lib/python2.5/site-packages/bzrlib/plugins/xmloutput [0.4.4]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Revision history for this message
Guillermo Gonzalez (verterok) wrote :

ups, I should run the full annotate tests, and not only the xml.
Please pull from trunk, it's fixed now. (at least all tests run Ok)

Regards,

Revision history for this message
Ole Dalgaard (ole-d) wrote :

Now it works, nice!

Changed in bzr-xmloutput:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.