##// END OF EJS Templates
config: abort early if the environment doesn't allow Python to pass Unicode strings to the file system layer...
Mads Kiilerich -
r7299:0e33880b default
parent child Browse files
Show More
@@ -120,6 +120,22 b' else:'
120 def setup_configuration(app):
120 def setup_configuration(app):
121 config = app.config
121 config = app.config
122
122
123 # Verify that things work when Dulwich passes unicode paths to the file system layer.
124 # Note: UTF-8 is preferred, but for example ISO-8859-1 or mbcs should also work under the right cirumstances.
125 try:
126 u'\xe9'.encode(sys.getfilesystemencoding()) # Test using é (é)
127 except UnicodeEncodeError:
128 log.error("Cannot encode Unicode paths to file system encoding %r", sys.getfilesystemencoding())
129 for var in ['LC_CTYPE', 'LC_ALL', 'LANG']:
130 if var in os.environ:
131 val = os.environ[var]
132 log.error("Note: Environment variable %s is %r - perhaps change it to some other value from 'locale -a', like 'C.UTF-8' or 'en_US.UTF-8'", var, val)
133 break
134 else:
135 log.error("Note: No locale setting found in environment variables - perhaps set LC_CTYPE to some value from 'locale -a', like 'C.UTF-8' or 'en_US.UTF-8'")
136 log.error("Terminating ...")
137 sys.exit(1)
138
123 # Mercurial sets encoding at module import time, so we have to monkey patch it
139 # Mercurial sets encoding at module import time, so we have to monkey patch it
124 hgencoding = config.get('hgencoding')
140 hgencoding = config.get('hgencoding')
125 if hgencoding:
141 if hgencoding:
General Comments 0
You need to be logged in to leave comments. Login now