Package: python2.3-htmlgen
Version: 2.2.2-10
Severity: normal
htmlgen raise an exception with utf-8 is used.
Note:
unicode can easily be used in python.:
1/ in second line of script file
# -*- coding: utf-8 -*-
2/
import codecs
3/ assumig you want to read a file in utf-8 or latin1, or ascii:
try:
f = codecs.open(filename, "r", 'utf-8')
content = f.read()
except:
try:
f = codecs.open(filename, "r", 'latin1')
content = f.read()
except:
f = codecs.open(filename, "r", 'ascii')
content = f.read()
f.close()
here after the exception raised by the bug.
[EMAIL PROTECTED]:/home/gay/Prestations/2006/....../....._26$
~/cvs_localdirectory/browser/ptu/ptu_parser.py
./......._B_3_1/..._..._...._........__2.ptu > /dev/null
Traceback (most recent call last):
File "/home/users/gay/cvs_localdirectory/browser/ptu/ptu_parser.py",
line 122, in ?
main()
File "/home/users/gay/cvs_localdirectory/browser/ptu/ptu_parser.py",
line 119, in main
a(content)
File "/home/users/gay/cvs_localdirectory/browser/ptu/ptu_parser.py",
line 88, in a
doc.write ('toto.html')
File "/usr/lib/python2.3/site-packages/HTMLgen/HTMLgen.py", line 188,
in write
f.write(str(self))
File "/usr/lib/python2.3/site-packages/HTMLgen/HTMLgen.py", line 406,
in __str__
s.append((bodystring % tuple(self.contents)))
File "/usr/lib/python2.3/site-packages/HTMLgen/HTMLgen.py", line 1835,
in __str__
s.append(str(item))
File "/usr/lib/python2.3/site-packages/HTMLgen/HTMLgen.py", line 1835,
in __str__
s.append(str(item))
File "/usr/lib/python2.3/site-packages/HTMLgen/HTMLgen.py", line 1835,
in __str__
s.append(str(item))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in
position 2: ordinal not in range(128)
-- System Information:
Debian Release: testing/unstable
APT prefers testing
APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-1-686
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)
Versions of packages python2.3-htmlgen depends on:
ii python2.3 2.3.5-8 An interactive high-level object-o
Versions of packages python2.3-htmlgen recommends:
pn python2.3-imaging <none> (no description available)
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]