mirror of
https://github.com/beetbox/beets.git
synced 2026-01-06 16:02:53 +01:00
revert a silly decision about hard-coding latin1
Decoding a path as latin1 when it appears undecodable is a non-solution because, the next time we want to actually *use* the path, it will be encoded differently and the file won't be found. Death to undecodable paths!
This commit is contained in:
parent
8eeaead135
commit
eff42d2136
1 changed files with 1 additions and 12 deletions
|
|
@ -165,18 +165,7 @@ def _unicode_path(path):
|
|||
if isinstance(path, unicode):
|
||||
return path
|
||||
encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
|
||||
try:
|
||||
out = path.decode(encoding)
|
||||
except UnicodeError:
|
||||
# This is of course extremely hacky, but I've received several
|
||||
# reports of filesystems misrepresenting their encoding as
|
||||
# UTF-8 and actually providing Latin-1 strings. This helps
|
||||
# handle those cases. All this is the cost of dealing
|
||||
# exclusively with Unicode pathnames internally (which
|
||||
# simplifies their construction from metadata and storage in
|
||||
# SQLite).
|
||||
out = path.decode('latin1')
|
||||
return out
|
||||
return path.decode(encoding)
|
||||
|
||||
# Note: POSIX actually supports \ and : -- I just think they're
|
||||
# a pain. And ? has caused problems for some.
|
||||
|
|
|
|||
Loading…
Reference in a new issue