Skip to content

Fixed: Values encoding on Windows#1414

Merged
insspb merged 2 commits intocookiecutter:masterfrom
agateau:fix/wrong-json-encoding-on-windows
May 29, 2020
Merged

Fixed: Values encoding on Windows#1414
insspb merged 2 commits intocookiecutter:masterfrom
agateau:fix/wrong-json-encoding-on-windows

Conversation

@agateau
Copy link
Copy Markdown
Contributor

@agateau agateau commented May 29, 2020

When using cookiecutter on the cookiecutter I am working on (https://github.com/agateau/cookiecutter-qt-app) and using the default values except for selecting the MIT license, the author name appeared wrongly encoded both in the prompt default value and in the generated LICENSE file.

Explicitly setting the encoding to utf-8 when reading the context file fixes this.

This only happens on Windows for me: the added test pass with or without the fix on Linux, but fails without the fix on Windows.

@agateau agateau force-pushed the fix/wrong-json-encoding-on-windows branch 2 times, most recently from e231204 to 9948a60 Compare May 29, 2020 07:53
Explicitly set the encoding to utf-8 when reading the context file to
ensure values are correctly loaded.
@agateau agateau force-pushed the fix/wrong-json-encoding-on-windows branch from 9948a60 to e55467b Compare May 29, 2020 16:23
@insspb insspb added the bug This issue/PR relates to a bug. label May 29, 2020
@insspb insspb added the windows This issue/PR related to windows systems only label May 29, 2020
@insspb insspb changed the title Fix default values being loaded with wrong encoding on Windows Fixed: Values encoding on Windows May 29, 2020
@insspb
Copy link
Copy Markdown
Member

insspb commented May 29, 2020

@agateau thank you for contribution.

You commit merged to master branch. You can test it there, as well as many features that will be available in cookiecutter 2.0

With cookiecutter 2.0 we want to extend windows support, so if you find any windows related bugs please report.
Encoding problems discussion began in 2014 in #248 Please leave you thoughts there.

Also you can make a great help with review of existing windows related issues, and maybe introducing some bugfixes.

@insspb insspb added this to the 2.0.0 milestone May 29, 2020
@insspb insspb merged commit 7f6804c into cookiecutter:master May 29, 2020
@insspb insspb self-assigned this May 30, 2020
@agateau
Copy link
Copy Markdown
Contributor Author

agateau commented Jun 1, 2020

Thanks for merging this fix. Unfortunately I am not a Windows expert: I do most of my work on Linux, I just want it to work on Windows. Getting that one-liner done took a long time (and much cursing!).

My 2 cents regarding encoding (again as a mostly Linux user, sometimes dabbling on other platforms) would be: standardize on every file being utf-8, but do not assume it is the default encoding on the OS, so always specify it.

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

Labels

bug This issue/PR relates to a bug. windows This issue/PR related to windows systems only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants