Skip to content
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

Unicode/ASCII issue when drawing grid #12

Closed
mnp opened this issue Mar 8, 2019 · 4 comments
Closed

Unicode/ASCII issue when drawing grid #12

mnp opened this issue Mar 8, 2019 · 4 comments

Comments

@mnp
Copy link

mnp commented Mar 8, 2019

Python 3.6.7 in a gnome-terminal, installed with pip3 install --user. Thanks!

$ wget http://levien.com/Social%20rule.puz
$ cursewords 'Social rule.puz'

Traceback (most recent call last):
  File "/home/mnp/.local/bin/cursewords", line 11, in <module>
    sys.exit(main())
  File "/home/mnp/.local/lib/python3.6/site-packages/cursewords/cursewords.py", line 751, in main
    grid.draw()
  File "/home/mnp/.local/lib/python3.6/site-packages/cursewords/cursewords.py", line 150, in draw
    + self.term.dim(top_row))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 10-70: ordinal not in range(128)
@mnp
Copy link
Author

mnp commented Mar 9, 2019

Solved my own problem. Bit the bullet and...

export LANGUAGE="en_US.UTF-8"
export LANG="en_US.UTF-8"

@thisisparker
Copy link
Owner

OK, good to know! @mnp do you happen to know what your $LANG/$LANGUAGE were set to before? And if you didn't set them yourself, would you mind saying what your OS set-up is?

@mnp
Copy link
Author

mnp commented Mar 10, 2019

Refining the above: First, I was using LANG=C, that was no bueno. There was actually an OS bug long ago in the GNU-C library that would make sort about 10x slower because the UTF-8 collation function was used instead of the old K&R one. Anyway, there may be no reason to use LANG=C now. This was Ubuntu Bionic in a gnome-terminal.

Also, all it needed was export LANG=en_US.UTF-8. It seems $LANGUAGE was not necessary.

@thisisparker
Copy link
Owner

Alright, great. I'm closing this issue because we got it resolved for you (and it seems to be a pretty isolated case, at least so far) but I've opened #17 to provide a better failure notice on things like this, generally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants