Support for non ASCII usernames in Windows.

svn: r14383
This commit is contained in:
Peter Landgren 2010-02-15 11:12:09 +00:00
parent f97e6622e4
commit c0f37e1a42

View File

@ -33,6 +33,7 @@ creating, and deleting of databases.
#
#-------------------------------------------------------------------------
import os
import sys
import time
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
@ -384,6 +385,10 @@ def find_locker_name(dirpath):
fname = os.path.join(dirpath, "lock")
ifile = open(fname)
username = ifile.read().strip()
# Convert username to unicode according to system encoding
# Otherwise problems with non ASCII characters in
# username in Windows
username = unicode(username, sys.getfilesystemencoding())
last = _("Locked by %s") % username
ifile.close()
except (OSError, IOError):