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 handling #138

Merged
merged 4 commits into from Jul 11, 2016
Merged

Unicode handling #138

merged 4 commits into from Jul 11, 2016

Conversation

brutasse
Copy link
Contributor

@brutasse brutasse commented Jun 3, 2016

Fixes #118
Fixes #135

Following #135, here's my proposal for keeping unicode data internally and having safe __repr__ implementations. More details can be found in the commit message.

Additional changes:

  • Some README formatting fixes
  • Replace deprecated assertEquals with assertEqual (avoids a warning on Python3)
  • Add Tox support to easily run tests for a bunch of Python versions. I don't know what the project targets are, so I only put Python 2.7, 3.4 and 3.5.

`.encode()` and `.decode()` calls were added because of various objects
gaining a `__repr__()` implementation. `__repr__()` needs to return `str` on
Python 2 (byte string) and `str` on Python 3 (unicode string).

This commit keeps everything in unicode strings internally, improving behavior
on Python 3. Unfortunately, this also breaks existing Python 3 code relying on
various attributes being bytes.

Also introduce a `compat` module to easily return `str` from any string in
Python 2 and 3.
This allows running 'tox' and get all tests run for various Python versions,
in isolated virtual environments.
@brutasse
Copy link
Contributor Author

brutasse commented Jun 3, 2016

Note that Python 3 code relying on the current behavior (board name being bytes for example) will break. But it's for a greater good :)

@sarumont sarumont merged commit c7907dd into sarumont:master Jul 11, 2016
@sarumont sarumont mentioned this pull request Jul 11, 2016
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

Successfully merging this pull request may close these issues.

Unicode handling Meaningless .encode('utf-8').decode('utf-8') ?
3 participants