Package: python2.5
Version: 2.5.2-3
Severity: normal
If the default encoding in python is utf-8
#!/usr/bin/env python
# -*- coding: utf-8 -*-
and the filesystem is utf-8 (default for debian)
and a filename contains utf-8 characters > 128
then os.path.join fails with:
File "/usr/lib/python2.5/posixpath.py", line 65, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 3: ordinal
not in range(128)
trying to decode(utf-8) the paths gives:
curfile = join(dirname.decode('utf-8'), name.decode('utf-8'))
File "/usr/lib/python2.5/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 2-5: invalid
data
perhaps because it was called as part of an os.path.walk (because os.walk
failed on join)
os.path.walk also fails to join even if the above join is commented out.
This is even with passing unicode objects to os.walk and os.path.walk
os.path.join seems to get confused with utf-8 as the default
The workaround in my app is to write my own os.walk and avoid os.path.join
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (500, 'testing'), (500, 'stable'), (1, 'experimental'), (1,
'unstable'), (1, 'testing'), (1, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.24-1-686 (SMP w/1 CPU core)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages python2.5 depends on:
ii libbz2-1.0 1.0.5-0.1 high-quality block-sorting file co
ii libc6 2.7-10 GNU C Library: Shared libraries
ii libdb4.5 4.5.20-11 Berkeley v4.5 Database Libraries [
ii libncursesw5 5.6+20080308-1 Shared libraries for terminal hand
ii libreadline5 5.2-3 GNU readline and history libraries
ii libsqlite3-0 3.5.8-4 SQLite 3 shared library
ii libssl0.9.8 0.9.8g-10 SSL shared libraries
ii mime-support 3.40-1.1 MIME files 'mime.types' & 'mailcap
ii python2.5-minimal 2.5.2-3 A minimal subset of the Python lan
python2.5 recommends no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]