commit with commit message in unexpected encoding gives unfriendly error

Bug #64653 reported by Zunbeltz Izaola
28
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Low
Unassigned

Bug Description

I have commit with a MSGFILE
 bzr ci --file=logfile

and I get the following error msg
zunbeltz@ubuntu:~/tesis$ bzr ci --file=logfile
bzr: ERROR: exceptions.UnicodeDecodeError: 'utf8' codec can't decode bytes in position 61-64: invalid data

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 611, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 573, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 282, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.4/site-packages/bzrlib/builtins.py", line 1785, in run message = codecs.open(file, 'rt', bzrlib.user_encoding).read()
  File "/usr/lib/python2.4/codecs.py", line 481, in read
    return self.reader.read(size)
  File "/usr/lib/python2.4/codecs.py", line 293, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 61-64: invalid data

bzr 0.11.0 on python 2.4.3.final.0 (linux2)
arguments: ['/usr/bin/bzr', 'ci', '--file=logfile']

** please send this report to <email address hidden>

Revision history for this message
Zunbeltz Izaola (zunbeltz) wrote :

I attach the logfile

Revision history for this message
John A Meinel (jameinel) wrote :

I think this just means you need to configure your Mac to recognize that it should be using UTF-8 encoding.

This can be done my setting "LANG=xxx.UTF-8"

Revision history for this message
Zunbeltz Izaola (zunbeltz) wrote :

I am using Ubuntu linux, and my language is using UTF-8

zunbeltz@lcpxdf:~ $ echo $LANG
eu_ES.UTF-8
zunbeltz@lcpxdf:~ $

Revision history for this message
John A Meinel (jameinel) wrote :

Sorry about that. Someone else was just reporting a "could not submit UTF-8 message" bug, the same day as you, and I thought this was the same thing. (I didn't read closely).

so there are 2 things here:

1) Your message is not in UTF-8. On inspection, it looks like it is in latin-1 (iso-8859-1). Since you have configured your system as eu_ES.UTF-8, we expect file contents to be in UTF-8.
If you changed your encoding to eu_ES, I think it would expect the encoding to be in latin-1.

2) We should be giving you a nicer error message anyway. At least making it clearer that the file is not in the expected encoding.

Revision history for this message
Zunbeltz Izaola (zunbeltz) wrote :

You are correct. My file was not in UTF-8. I use emacs. Today I save the file in UTF-8 and it works ok.

I agree that the error message should be nicer. It is not possible to have bzr transform form latin1 to utf8 silently.

Changed in bzr:
importance: Undecided → Low
status: Unconfirmed → Confirmed
Revision history for this message
Martin Pool (mbp) wrote :

See also bug 520604 asking for an option to specify the message encoding.

tags: added: encoding unicode
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: removed: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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