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

Early adopt UTF-8 Mode on Windows. #18041

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

smithdc1
Copy link
Member

@smithdc1 smithdc1 commented Apr 2, 2024

Python 3.15 will enable UTF-8 mode by default

https://peps.python.org/pep-0686/#enable-utf-8-mode-by-default

@nessita
Copy link
Contributor

nessita commented Apr 4, 2024

Hey @smithdc1, I find this PR valuable and I think we should merge it. Is there something else that needs to be checked before marking it ready for review?

@smithdc1 smithdc1 marked this pull request as ready for review April 4, 2024 19:14
@smithdc1
Copy link
Member Author

smithdc1 commented Apr 4, 2024

Hi @nessita this is ready for review. 👍

(Do you want me to create / find a ticket to reference?)

@adamchainz
Copy link
Sponsor Member

Is there much risk that we will miss bugs that only occur in non-UTF-8 mode?

@nessita
Copy link
Contributor

nessita commented Apr 10, 2024

Is there much risk that we will miss bugs that only occur in non-UTF-8 mode?

Do you have any more details about your thinking?

To understand more about this, I spent some time reading thru:

My understanding so far is that using UTF-8 as the default encoding for writing and reading is the right thing to do for Windows users to have the best experience, and if Python did not switch the default sooner was only to be super cautious.
The biggest concern as I understood it was reading and interacting with config files or similar that would have been written to the FS without an explicit encoding, specifically when they include non-ascii characters. I'm not sure this would be of relevance for Django? The main counterargument is that writing a file without passing an encoding explicitly should be treated as a bug on its own, and that that scenario has other problems on their own.

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