1. Marcin Kuzminski
  2. RhodeCode
  3. Issues

Issues

Issue #403 resolved

UnicodeDecodeError: 'ascii' codec can't decode byte

cougar
created an issue

today I update the rhodecode, the old version is ok.

{{{

!python

File "/usr/local/lib/python2.7/site-packages/RhodeCode-1.3.3-py2.7.egg/rhodecode/lib/utils.py", line 193, in _get_repos for inner_scm in _get_repos(rec_path): File "/usr/local/lib/python2.7/site-packages/RhodeCode-1.3.3-py2.7.egg/rhodecode/lib/utils.py", line 193, in _get_repos for inner_scm in _get_repos(rec_path): File "/usr/local/lib/python2.7/site-packages/RhodeCode-1.3.3-py2.7.egg/rhodecode/lib/utils.py", line 181, in _get_repos if os.path.isfile(os.path.join(p, dirpath)): File "/usr/local/lib/python2.7/posixpath.py", line 71, in join path += '/' + b UnicodeDecodeError: 'ascii' codec can't decode byte 0xb8 in position 9: ordinal not in range(128) Removing PID file paster.pid }}}

Comments (15)

  1. cougar reporter

    when start the web . I delete all the old repo like rm, then is work ok.

    2012-03-20 09:56:24.160 INFO  [rhodecode.model] initializing db for Engine(sqlite:////usr/home/wjl/srv/repo-estor/rhodecode.db)
    2012-03-20 09:56:24.322 INFO  [rhodecode.model.scm] scanning for repositories in /usr/home/wjl/srv/repo
    qTraceback (most recent call last):
      File "/usr/local/bin/paster", line 8, in <module>
        load_entry_point('PasteScript==1.7.4.1', 'console_scripts', 'paster')()
      File "/usr/local/lib/python2.7/site-packages/PasteScript-1.7.4.1-py2.7.egg/paste/script/command.py", line 104, in run
        invoke(command, command_name, options, args[1:])
      File "/usr/local/lib/python2.7/site-packages/PasteScript-1.7.4.1-py2.7.egg/paste/script/command.py", line 143, in invoke
        exit_code = runner.run(args)
      File "/usr/local/lib/python2.7/site-packages/PasteScript-1.7.4.1-py2.7.egg/paste/script/command.py", line 238, in run
        result = self.command()
      File "/usr/local/lib/python2.7/site-packages/PasteScript-1.7.4.1-py2.7.egg/paste/script/serve.py", line 284, in command
        relative_to=base, global_conf=vars)
      File "/usr/local/lib/python2.7/site-packages/PasteScript-1.7.4.1-py2.7.egg/paste/script/serve.py", line 321, in loadapp
        **kw)
      File "/usr/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 247, in loadapp
        return loadobj(APP, uri, name=name, **kw)
      File "/usr/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 272, in loadobj
        return context.create()
      File "/usr/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 710, in create
        return self.object_type.invoke(self)
      File "/usr/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 146, in invoke
        return fix_call(context.object, context.global_conf, **context.local_conf)
      File "/usr/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/util.py", line 56, in fix_call
        val = callable(*args, **kw)
      File "/usr/local/lib/python2.7/site-packages/RhodeCode-1.3.3-py2.7.egg/rhodecode/config/middleware.py", line 40, in make_app
        config = load_environment(global_conf, app_conf)
      File "/usr/local/lib/python2.7/site-packages/RhodeCode-1.3.3-py2.7.egg/rhodecode/config/environment.py", line 77, in load_environment
        repo2db_mapper(ScmModel().repo_scan(repos_path))
      File "/usr/local/lib/python2.7/site-packages/RhodeCode-1.3.3-py2.7.egg/rhodecode/model/scm.py", line 184, in repo_scan
        for name, path in get_filesystem_repos(repos_path, recursive=True):
      File "/usr/local/lib/python2.7/site-packages/RhodeCode-1.3.3-py2.7.egg/rhodecode/lib/utils.py", line 192, in _get_repos
        for inner_scm in _get_repos(rec_path):
      File "/usr/local/lib/python2.7/site-packages/RhodeCode-1.3.3-py2.7.egg/rhodecode/lib/utils.py", line 192, in _get_repos
        for inner_scm in _get_repos(rec_path):
      File "/usr/local/lib/python2.7/site-packages/RhodeCode-1.3.3-py2.7.egg/rhodecode/lib/utils.py", line 192, in _get_repos
        for inner_scm in _get_repos(rec_path):
      File "/usr/local/lib/python2.7/site-packages/RhodeCode-1.3.3-py2.7.egg/rhodecode/lib/utils.py", line 180, in _get_repos
        if os.path.isfile(os.path.join(p, dirpath)):
      File "/usr/local/lib/python2.7/posixpath.py", line 71, in join
        path += '/' + b
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xb8 in position 9: ordinal not in range(128)
    Removing PID file paster.pid
    
  2. Gilles Bouthenot

    I reproduced this bug by creating a repository with non-ascii character. repo name="Dépôt git".

    The directory was created with the right name, as the database entry in the table "repositories", but posixpath.py throws the same exception.

    Please filter the name of repositories so it only contain ascii characters.

    (tested with the latest beta)

  3. Marcin Kuzminski repo owner

    i spent so much time making the system compatible with non-ascii directories than it would be a waste to disable this. Creating the name as you gave as example and trying deleting it raises this exception ? (There's a test for that for non-ascii repostiories btw). Would really like steps to reproduce this. Thanks

  4. Gilles Bouthenot

    Just tested with the latest default: 2931:026609c4ef02

    Log to rhodecode. Create new repo "testé1", type:"HG", "private". --> Error 500

    Rhodecode is completely crashed. Even trying to go to the homepage of the local rhodecode site from another computer result in Error 500.

    To repair it: sqlite3 rhodecode.sqlite sqlite> .headers ON sqlite> select * from repositories; repo_id|repo_name|clone_uri|repo_type|user_id|private|statistics|downloads|description|created_on|updated_on|landing_revision|enable_locking|locked|fork_id|group_id 7|testé1||hg|4|1|0|1|testé1|2012-09-12 09:53:02.968891|2012-09-12 09:53:02.968905|tip|0||| sqlite> update repositories set repo_name="teste1" where repo_id=7; sqlite> exit

    cd repositories/ $ ls -al drwxr-xr-x 3 rhodecode rhodecode 4096 Sep 12 09:53 testé1

    $ mv testé1 teste1

    And it works again.

    Stack log (from apache2 error_log:) Please note, that it is posix path that is crashing. Tested on debian-stable (python-2.6)

    mod_wsgi (pid=3491): Exception occurred processing WSGI script '/home/rhodecode/homes/conf/dispatch.wsgi'. Traceback (most recent call last): File "/home/rhodecode/homes/conf/dispatch.wsgi", line 15, in <module> application = loadapp('config:/home/rhodecode/homes/conf/production.ini') File "/home/rhodecode/homes/env/lib/python2.6/site-packages/PasteDeploy-1.5.0-py2.6.egg/paste/deploy/loadwsgi.py", line 247, in loadapp return loadobj(APP, uri, name=name, kw) File "/home/rhodecode/homes/env/lib/python2.6/site-packages/PasteDeploy-1.5.0-py2.6.egg/paste/deploy/loadwsgi.py", line 272, in loadobj return context.create() File "/home/rhodecode/homes/env/lib/python2.6/site-packages/PasteDeploy-1.5.0-py2.6.egg/paste/deploy/loadwsgi.py", line 710, in create return self.object_type.invoke(self) File "/home/rhodecode/homes/env/lib/python2.6/site-packages/PasteDeploy-1.5.0-py2.6.egg/paste/deploy/loadwsgi.py", line 146, in invoke return fix_call(context.object, context.global_conf, context.local_conf) File "/home/rhodecode/homes/env/lib/python2.6/site-packages/PasteDeploy-1.5.0-py2.6.egg/paste/deploy/util.py", line 56, in fix_call val = callable(*args, kw) File "/home/rhodecode/homes/rhodecode/rhodecode/config/middleware.py", line 40, in make_app config = load_environment(global_conf, app_conf) File "/home/rhodecode/homes/rhodecode/rhodecode/config/environment.py", line 95, in load_environment repo2db_mapper(ScmModel().repo_scan(repos_path), File "/home/rhodecode/homes/rhodecode/rhodecode/model/scm.py", line 224, in repo_scan for name, path in get_filesystem_repos(repos_path, recursive=True): File "/home/rhodecode/homes/rhodecode/rhodecode/lib/utils.py", line 188, in _get_repos if os.path.isfile(os.path.join(p, dirpath)): File "/usr/lib/python2.6/posixpath.py", line 70, in join path += '/' + b UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128)

    $ $virtualenv/bin/python -v python -v

    1. installing zipimport hook import zipimport # builtin
    2. installed zipimport hook
    3. /home/rhodecode/homes/env/lib/python2.6/site.pyc matches /home/rhodecode/homes/env/lib/python2.6/site.py import site # precompiled from /home/rhodecode/homes/env/lib/python2.6/site.pyc
    4. /home/rhodecode/homes/env/lib/python2.6/os.pyc matches /home/rhodecode/homes/env/lib/python2.6/os.py import os # precompiled from /home/rhodecode/homes/env/lib/python2.6/os.pyc import errno # builtin import posix # builtin
    5. /home/rhodecode/homes/env/lib/python2.6/posixpath.pyc matches /home/rhodecode/homes/env/lib/python2.6/posixpath.py import posixpath # precompiled from /home/rhodecode/homes/env/lib/python2.6/posixpath.pyc
    6. /home/rhodecode/homes/env/lib/python2.6/stat.pyc matches /home/rhodecode/homes/env/lib/python2.6/stat.py import stat # precompiled from /home/rhodecode/homes/env/lib/python2.6/stat.pyc
    7. /home/rhodecode/homes/env/lib/python2.6/genericpath.pyc matches /home/rhodecode/homes/env/lib/python2.6/genericpath.py import genericpath # precompiled from /home/rhodecode/homes/env/lib/python2.6/genericpath.pyc
    8. /home/rhodecode/homes/env/lib/python2.6/warnings.pyc matches /home/rhodecode/homes/env/lib/python2.6/warnings.py import warnings # precompiled from /home/rhodecode/homes/env/lib/python2.6/warnings.pyc
    9. /home/rhodecode/homes/env/lib/python2.6/linecache.pyc matches /home/rhodecode/homes/env/lib/python2.6/linecache.py import linecache # precompiled from /home/rhodecode/homes/env/lib/python2.6/linecache.pyc
    10. /home/rhodecode/homes/env/lib/python2.6/types.pyc matches /home/rhodecode/homes/env/lib/python2.6/types.py import types # precompiled from /home/rhodecode/homes/env/lib/python2.6/types.pyc
    11. /home/rhodecode/homes/env/lib/python2.6/UserDict.pyc matches /home/rhodecode/homes/env/lib/python2.6/UserDict.py import UserDict # precompiled from /home/rhodecode/homes/env/lib/python2.6/UserDict.pyc
    12. /home/rhodecode/homes/env/lib/python2.6/_abcoll.pyc matches /home/rhodecode/homes/env/lib/python2.6/_abcoll.py import _abcoll # precompiled from /home/rhodecode/homes/env/lib/python2.6/_abcoll.pyc
    13. /home/rhodecode/homes/env/lib/python2.6/abc.pyc matches /home/rhodecode/homes/env/lib/python2.6/abc.py import abc # precompiled from /home/rhodecode/homes/env/lib/python2.6/abc.pyc
    14. /home/rhodecode/homes/env/lib/python2.6/copy_reg.pyc matches /home/rhodecode/homes/env/lib/python2.6/copy_reg.py import copy_reg # precompiled from /home/rhodecode/homes/env/lib/python2.6/copy_reg.pyc
    15. /usr/lib/python2.6/sitecustomize.pyc matches /usr/lib/python2.6/sitecustomize.py import sitecustomize # precompiled from /usr/lib/python2.6/sitecustomize.pyc import encodings # directory /home/rhodecode/homes/env/lib/python2.6/encodings
    16. /home/rhodecode/homes/env/lib/python2.6/encodings/init.pyc matches /home/rhodecode/homes/env/lib/python2.6/encodings/init.py import encodings # precompiled from /home/rhodecode/homes/env/lib/python2.6/encodings/init.pyc
    17. /home/rhodecode/homes/env/lib/python2.6/codecs.pyc matches /home/rhodecode/homes/env/lib/python2.6/codecs.py import codecs # precompiled from /home/rhodecode/homes/env/lib/python2.6/codecs.pyc import _codecs # builtin
    18. /home/rhodecode/homes/env/lib/python2.6/encodings/aliases.pyc matches /home/rhodecode/homes/env/lib/python2.6/encodings/aliases.py import encodings.aliases # precompiled from /home/rhodecode/homes/env/lib/python2.6/encodings/aliases.pyc
    19. /home/rhodecode/homes/env/lib/python2.6/encodings/utf_8.pyc matches /home/rhodecode/homes/env/lib/python2.6/encodings/utf_8.py import encodings.utf_8 # precompiled from /home/rhodecode/homes/env/lib/python2.6/encodings/utf_8.pyc Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. dlopen("/home/rhodecode/homes/env/lib/python2.6/lib-dynload/readline.so", 2); import readline # dynamically loaded from /home/rhodecode/homes/env/lib/python2.6/lib-dynload/readline.so
  5. Gilles Bouthenot

    I use utf8.

    This seems (again...) related to WSGI. When I "paster serve production.ini", the problem disappears.

    Any idea why posixpath.py does not handle non-ascii character, ONLY in wsgi mode ?

    This is another stack dump from an other server, with debian-testing (same problem):

    {{{ File "/var/local/rhodecode/conf/dispatch.wsgi", line 15, in <module> application = loadapp('config:/var/local/rhodecode/conf/production.ini') File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 247, in loadapp return loadobj(APP, uri, name=name, kw) File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 272, in loadobj return context.create() File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 710, in create return self.object_type.invoke(self) File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 146, in invoke return fix_call(context.object, context.global_conf, context.local_conf) File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/util.py", line 56, in fix_call val = callable(args, *kw) File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/RhodeCode-1.4.1-py2.7.egg/rhodecode/config/middleware.py", line 40, in make_app config = load_environment(global_conf, app_conf) File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/RhodeCode-1.4.1-py2.7.egg/rhodecode/config/environment.py", line 95, in load_environment repo2db_mapper(ScmModel().repo_scan(repos_path), File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/RhodeCode-1.4.1-py2.7.egg/rhodecode/model/scm.py", line 224, in repo_scan for name, path in get_filesystem_repos(repos_path, recursive=True): File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/RhodeCode-1.4.1-py2.7.egg/rhodecode/lib/utils.py", line 188, in _get_repos if os.path.isfile(os.path.join(p, dirpath)): File "/var/local/rhodecode/virtualenv/lib/python2.7/posixpath.py", line 71, in join path += '/' + b UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128) }}}

  6. Gilles Bouthenot

    This is the dispatch.wsgi script:

    import os
    os.environ["HGENCODING"] = "UTF-8"
    os.environ['PYTHON_EGG_CACHE'] = '/var/local/rhodecode/.egg-cache'
    
    # sometimes it's needed to set the curent dir
    os.chdir('/var/local/rhodecode/virtualenv')
    
    import site
    site.addsitedir("/var/local/rhodecode/virtualenv/lib/python2.7/site-packages/")
    
    from paste.deploy import loadapp
    from paste.script.util.logging_config import fileConfig
    
    fileConfig('/var/local/rhodecode/conf/production.ini')
    application = loadapp('config:/var/local/rhodecode/conf/production.ini')
    

    And this is the apache configuration:

    WSGIPythonHome /var/local/rhodecode/virtualenv               
    WSGIPythonPath /var/local/rhodecode/virtualenv//lib/python2.7/site-packages
    WSGIDaemonProcess pylons threads=4 python-path=/var/local/rhodecode/virtualenv/lib/python2.7/site-packages
    WSGIScriptAlias / /var/local/rhodecode/conf/dispatch.wsgi            
    WSGIPassAuthorization On                            
    
    

    I had to had WSGIPythonHome and WSGIPythonPath because otherwise, the stack dump called the system "/usr/lib/python2.7/posixpath.py"). Even with these line, the problem still occurs, but now, it is in the virtualenv (see the last stackdump I posted a few minutes ago.

    (original message:) I use utf8.

    This seems (again...) related to WSGI. When I "paster serve production.ini", the problem disappears.

    Any idea why posixpath.py does not handle non-ascii character, ONLY in wsgi mode ?

    This is another stack dump from an other server, with debian-testing (same problem):

    File "/var/local/rhodecode/conf/dispatch.wsgi", line 15, in <module>
      application = loadapp('config:/var/local/rhodecode/conf/production.ini')
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 247, in loadapp
      return loadobj(APP, uri, name=name, **kw)
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 272, in loadobj
      return context.create()
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 710, in create
      return self.object_type.invoke(self)
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 146, in invoke
      return fix_call(context.object, context.global_conf, **context.local_conf)
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/util.py", line 56, in fix_call
      val = callable(*args, **kw)
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/RhodeCode-1.4.1-py2.7.egg/rhodecode/config/middleware.py", line 40, in make_app
      config = load_environment(global_conf, app_conf)
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/RhodeCode-1.4.1-py2.7.egg/rhodecode/config/environment.py", line 95, in load_environment
      repo2db_mapper(ScmModel().repo_scan(repos_path),
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/RhodeCode-1.4.1-py2.7.egg/rhodecode/model/scm.py", line 224, in repo_scan
      for name, path in get_filesystem_repos(repos_path, recursive=True):
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/RhodeCode-1.4.1-py2.7.egg/rhodecode/lib/utils.py", line 188, in _get_repos
      if os.path.isfile(os.path.join(p, dirpath)):
    File "/var/local/rhodecode/virtualenv/lib/python2.7/posixpath.py", line 71, in join
      path += '/' + b
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128)
    
    
  7. Gilles Bouthenot

    (Original post, don't know why it didn't make into bitbucket issue system):

    I use utf8.

    This seems (again...) related to WSGI. When I "paster serve production.ini", the problem disappears.

    Any idea why posixpath.py does not handle non-ascii character, ONLY in wsgi mode ?

    This is another stack dump from an other server, with debian-testing (same problem):

    File "/var/local/rhodecode/conf/dispatch.wsgi", line 15, in <module>
      application = loadapp('config:/var/local/rhodecode/conf/production.ini')
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 247, in loadapp
      return loadobj(APP, uri, name=name, **kw)
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 272, in loadobj
      return context.create()
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 710, in create
      return self.object_type.invoke(self)
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 146, in invoke
      return fix_call(context.object, context.global_conf, **context.local_conf)
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/util.py", line 56, in fix_call
      val = callable(*args, **kw)
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/RhodeCode-1.4.1-py2.7.egg/rhodecode/config/middleware.py", line 40, in make_app
      config = load_environment(global_conf, app_conf)
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/RhodeCode-1.4.1-py2.7.egg/rhodecode/config/environment.py", line 95, in load_environment
      repo2db_mapper(ScmModel().repo_scan(repos_path),
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/RhodeCode-1.4.1-py2.7.egg/rhodecode/model/scm.py", line 224, in repo_scan
      for name, path in get_filesystem_repos(repos_path, recursive=True):
    File "/var/local/rhodecode/virtualenv/local/lib/python2.7/site-packages/RhodeCode-1.4.1-py2.7.egg/rhodecode/lib/utils.py", line 188, in _get_repos
      if os.path.isfile(os.path.join(p, dirpath)):
    File "/var/local/rhodecode/virtualenv/lib/python2.7/posixpath.py", line 71, in join
      path += '/' + b
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128)
    
    
  8. Gilles Bouthenot

    I have FOUND it !!!

    This seems related to the LANG environment variable export LANG=en_US.UTF-8 --> ok export LANG=C --> unicode error (even with paster serve !)

    Setting Apache2 GLOBAL environment variable "LANG" to "en_US.UTF-8" fixed the problem.

    With Debian, I had to edit /etc/apache2/ennvars: export LANG=en_US.UTF-8 (it was set to "C")

    I tried to: - add os.environ["LANG"] = "en_US.UTF-8" at the start of the wsgi script -> the environment variable is set, but the bug is still there

    - add SetEnv LANG "en_US.UTF-8" in my apache2 virtual host (even outside) -> it does not change the variable

    So the only way I found was to alter /etc/apache2/envvars and it WORKS !!

  9. Gilles Bouthenot

    Since the default LANG was "C". I think that the best choice is to set it to "C.UTF-8" instead of "en_US.UTF-8". By the way, I also tried to put that is the wsgi script:

    import locale
    locale.setlocale( locale.LC_ALL, 'C.UTF-8' )
    

    but it didn't work.

    So far, the only solution seems to alter the /etc/apache2/envvars file. But why is Python dependant of the system LANG for os.path operation ?

    http://docs.python.org/library/os.path.html does not mention that.

  10. Gilles Bouthenot

    Nice catch too ! I did not find any document with this problem. But this is not completely related to wsgi. The very same problem occurs with "paster server production.ini" when the locale is not set to UTF-8.

    I really don't know why Python is dependant of this variable.

    To reproduce it: export LANG=C paster server production.ini

    If any repository pathname contain a non-ascii character ("é" in our case), the server won't be able to start and will crash immediately.

  11. Log in to comment