New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError when certain locale variable(s) is set to "C" #581

Closed
Vdragon opened this Issue Jul 11, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@Vdragon
Contributor

Vdragon commented Jul 11, 2016

I've been using non-ASCII paths without encountering UnicodeDecodeErrors for a while(like "$HOME/工作空間/第三方專案/Git Cola"), I have no idea why it fails on "$HOME/工作空間/個人專案/List Debugging Symbol Packages" case...

Also reproduced on v2.5

UPDATE: I found a lead, I launched git cola from a shell which previously meddled with locale environment variables to debug the script(basically turns off the localization):

LANG=C
LANGUAGE=zh_TW:zh_HK:zh_CN:en_US:en
LC_CTYPE="C"
LC_NUMERIC=zh_TW.UTF-8
LC_TIME=zh_TW.UTF-8
LC_COLLATE="C"
LC_MONETARY=zh_TW.UTF-8
LC_MESSAGES="C"
LC_PAPER=zh_TW.UTF-8
LC_NAME=zh_TW.UTF-8
LC_ADDRESS=zh_TW.UTF-8
LC_TELEPHONE=zh_TW.UTF-8
LC_MEASUREMENT=zh_TW.UTF-8
LC_IDENTIFICATION=zh_TW.UTF-8
LC_ALL=

After I set all the LC_* and LANG environment variables back to zh_TW.UTF-8 Git Cola launches perfectly~~, I suspect the setting of LANG to C disable the UTF-8 decoding somehow. I'm not sure it is rather a bug or something intended to work like that, or should we assume UTF-8 when LANG="C"?~~

Traceback

  File "/usr/local/bin/git-cola", line 53, in <module>
    from cola.main import main
  File "/usr/local/share/git-cola/lib/cola/main.py", line 6, in <module>
    from cola.app import add_common_arguments
  File "/usr/local/share/git-cola/lib/cola/app.py", line 62, in <module>
    from cola import cmds
  File "/usr/local/share/git-cola/lib/cola/cmds.py", line 17, in <module>
    from cola import fsmonitor
  File "/usr/local/share/git-cola/lib/cola/fsmonitor.py", line 39, in <module>
    from cola import gitcfg
  File "/usr/local/share/git-cola/lib/cola/gitcfg.py", line 12, in <module>
    from cola import git
  File "/usr/local/share/git-cola/lib/cola/git.py", line 300, in <module>
    git = current()
  File "/usr/local/share/git-cola/lib/cola/decorators.py", line 27, in _decorated
    return caller(func, *args, **opts)
  File "/usr/local/share/git-cola/lib/cola/decorators.py", line 53, in _memoize
    result = cache[key] = func(*args, **opts)
  File "/usr/local/share/git-cola/lib/cola/git.py", line 297, in current
    return Git()
  File "/usr/local/share/git-cola/lib/cola/git.py", line 66, in __init__
    self.set_worktree(core.getcwd())
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 14: ordinal not in range(128)

Reporter's Environment

Operating System

Ubuntu 16.04

Desktop Environment

Unity

Git Cola

Current HEAD, which's eceb1b7

@Vdragon Vdragon changed the title from UnicodeDecodeError on certain current working directory to UnicodeDecodeError when certain locale variable(s) is set to "C" Jul 11, 2016

@davvid davvid closed this in 09e21fb Jul 11, 2016

@Vdragon

This comment has been minimized.

Show comment
Hide comment
@Vdragon

Vdragon Jul 11, 2016

Contributor

Thanks! It's working now.

Contributor

Vdragon commented Jul 11, 2016

Thanks! It's working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment