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

Fix cross-platform encoding issues. #428

Merged
merged 1 commit into from Apr 8, 2015
Merged

Conversation

waylan
Copy link
Member

@waylan waylan commented Apr 7, 2015

By using io.open and explicitly defining the encoding on the call to
open every time, we should get consistant behavior across platforms
as open will not rely on each individual system's local settings
to determine what encoding to use. Note that io.open is an alias
to the built-in open function in Python 3. In Python 2.6+ it is a
Python 3 compatable implementation which works in Python 2. In the
future when all support for Python 2 is dropped, simply delete the
import statements with no additional changes to the code.

I expect this will fix both #239 and #352.

By using io.open and explicitly defining the encoding on the call to
open every time, we should get consistant behavior across platforms
as open will not rely on each individual system's local settings
to determine what encoding to use. Note that io.open is an alias
to the built-in open function in Python 3. In Python 2.6+ it is a
Python 3 compatable implementation which works in Python 2. In the
future when all support for Python 2 is dropped, simply delete the
import statements with no additional changes to the code.

I expect this will fix both mkdocs#239 and mkdocs#352.
@d0ugal
Copy link
Member

d0ugal commented Apr 8, 2015

Neat! This makes lots of sense to me. I'll wait a little bit to see if anyone comments on it helping, or not, but otherwise I'm happy to merge it anyway.

@d0ugal d0ugal added this to the 0.12.0 milestone Apr 8, 2015
@d0ugal d0ugal added the Bug label Apr 8, 2015
d0ugal added a commit that referenced this pull request Apr 8, 2015
Fix cross-platform encoding issues.
@d0ugal d0ugal merged commit 74d3191 into mkdocs:master Apr 8, 2015
@d0ugal
Copy link
Member

d0ugal commented Apr 8, 2015

I'm testing in a Windows VM and this seems to help, or at least, not cause further issues.

@waylan waylan deleted the encoding branch June 2, 2015 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants