UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2: ordinal not in range(128)

Showing 1-4 of 4 messages
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2: ordinal not in range(128) Stefan Kost 6/23/11 7:40 AM
Hi,

I am getting the python backtrace below. My documents are valid UTF-8 as it seems. Any idea?

Stefan

$ a2x --version
a2x 8.5.2

Traceback (most recent call last):
  File "/usr/bin/a2x", line 730, in <module>
    a2x.execute()
  File "/usr/bin/a2x", line 294, in execute
    self.__getattribute__('to_'+self.format)()  # Execute to_* functions.
  File "/usr/bin/a2x", line 493, in to_xhtml
    self.copy_resources(xhtml_file, src_dir, self.destination_dir)
  File "/usr/bin/a2x", line 443, in copy_resources
    lambda attrs: attrs.get('type') == 'text/css')
  File "/usr/bin/a2x", line 235, in find_resources
    parser.feed(open(f).read())
  File "/usr/lib/python2.6/HTMLParser.py", line 108, in feed
    self.goahead(0)
  File "/usr/lib/python2.6/HTMLParser.py", line 148, in goahead
    k = self.parse_starttag(i)
  File "/usr/lib/python2.6/HTMLParser.py", line 249, in parse_starttag
    attrvalue = self.unescape(attrvalue)
  File "/usr/lib/python2.6/HTMLParser.py", line 387, in unescape
    return re.sub(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));", replaceEntities, s)
  File "/usr/lib/python2.6/re.py", line 151, in sub
    return _compile(pattern, 0).sub(repl, string, count)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2: ordinal not in range(128)

Re: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2: ordinal not in range(128) Lex Trotman 6/23/11 4:32 PM
Hi Stefan,

Unfortunately this is a known bug in Python see http://bugs.python.org/issue3932

You must explicitly specify non-ascii encodings and a2x works around the bug.

Cheers
Lex

> --
> You received this message because you are subscribed to the Google Groups
> "asciidoc" group.
> To post to this group, send email to asci...@googlegroups.com.
> To unsubscribe from this group, send email to
> asciidoc+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/asciidoc?hl=en.
>

Re: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2: ordinal not in range(128) Stefan Kost 6/24/11 1:10 AM
Hi,

2011/6/24 Lex Trotman <ele...@gmail.com>

Hi Stefan,

Unfortunately this is a known bug in Python see http://bugs.python.org/issue3932

You must explicitly specify non-ascii encodings and a2x works around the bug.

actually I tried adding :encoding: UTF-8 but that did not help, but then manually upgrading to the latest asciidoc-8.6.5 helped.

Stefan

Re: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2: ordinal not in range(128) Lex Trotman 6/24/11 1:55 AM
On 24 June 2011 18:10, Stefan Kost <st....@gmail.com> wrote:
> Hi,
> 2011/6/24 Lex Trotman <ele...@gmail.com>
>>
>> Hi Stefan,
>>
>> Unfortunately this is a known bug in Python see
>> http://bugs.python.org/issue3932
>>
>> You must explicitly specify non-ascii encodings and a2x works around the
>> bug.
>
> actually I tried adding :encoding: UTF-8 but that did not help, but then
> manually upgrading to the latest asciidoc-8.6.5 helped.
> Stefan
>

Ah yes, 8.6.3 added the workaround based on an explicit encoding.

Cheers
Lex