normalize new filenames to with NFD

This commit is contained in:
Adrian Sampson 2012-03-26 12:14:30 -07:00
parent 3c4d8500e5
commit 823e36ad01
3 changed files with 3 additions and 0 deletions

View file

@ -18,6 +18,7 @@ import re
import sys
import logging
import shlex
import unicodedata
from unidecode import unidecode
from beets.mediafile import MediaFile
from beets import plugins
@ -877,6 +878,7 @@ class Library(BaseLibrary):
subpath = subpath_tmpl.substitute(mapping, funcs)
# Encode for the filesystem, dropping unencodable characters.
subpath = unicodedata.normalize('NFD', subpath)
if isinstance(subpath, unicode) and not fragment:
encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
subpath = subpath.encode(encoding, 'replace')

View file

@ -22,6 +22,7 @@ Changelog
file for easy importing to other systems. Thanks to Fabrice Laporte.
* :doc:`/plugins/bpd`: Use Gstreamer's ``playbin2`` element instead of the
deprecated ``playbin``.
* Filenames are normalized with Unicode Normal Form D (NFD).
1.0b13 (March 16, 2012)

Binary file not shown.