~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

(gz) Override Py_FileSystemDefaultEncoding to utf-8 from ascii for the bzr
 script (Martin Packman)

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
 
64
64
 
65
65
import bzrlib
66
 
from bzrlib import symbol_versioning
 
66
from bzrlib import symbol_versioning, _fs_enc
67
67
 
68
68
 
69
69
# Cross platform wall-clock time functionality with decent resolution.
293
293
# choke on a Unicode string containing a relative path if
294
294
# os.getcwd() returns a non-sys.getdefaultencoding()-encoded
295
295
# string.
296
 
_fs_enc = sys.getfilesystemencoding() or 'utf-8'
297
296
def _posix_abspath(path):
298
297
    # jam 20060426 rather than encoding to fsencoding
299
298
    # copy posixpath.abspath, but use os.getcwdu instead
1771
1770
    """
1772
1771
    global _selected_dir_reader
1773
1772
    if _selected_dir_reader is None:
1774
 
        fs_encoding = _fs_enc.upper()
1775
1773
        if sys.platform == "win32" and win32utils.winver == 'Windows NT':
1776
1774
            # Win98 doesn't have unicode apis like FindFirstFileW
1777
1775
            # TODO: We possibly could support Win98 by falling back to the
1783
1781
                _selected_dir_reader = Win32ReadDir()
1784
1782
            except ImportError:
1785
1783
                pass
1786
 
        elif fs_encoding in ('UTF-8', 'US-ASCII', 'ANSI_X3.4-1968'):
1787
 
            # ANSI_X3.4-1968 is a form of ASCII
 
1784
        elif _fs_enc in ('utf-8', 'ascii'):
1788
1785
            try:
1789
1786
                from bzrlib._readdir_pyx import UTF8DirReader
1790
1787
                _selected_dir_reader = UTF8DirReader()