Skip to content

bootstrap: add explicit UTF-8 encoding to text-mode open() calls#152536

Open
ozankenangungor wants to merge 1 commit intorust-lang:mainfrom
ozankenangungor:bootstrap-explicit-open-encoding
Open

bootstrap: add explicit UTF-8 encoding to text-mode open() calls#152536
ozankenangungor wants to merge 1 commit intorust-lang:mainfrom
ozankenangungor:bootstrap-explicit-open-encoding

Conversation

@ozankenangungor
Copy link

This makes all text-mode open() calls in bootstrap.py
explicitly use encoding="utf-8".

Binary-mode ("rb" / "wb") opens are left unchanged.

The change is purely mechanical and does not alter behavior.

Tested with:
./x.py test bootstrap

Copilot AI review requested due to automatic review settings February 12, 2026 14:02
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Feb 12, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 12, 2026

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789, jieyouxu

This comment was marked as spam.

@Kobzol
Copy link
Member

Kobzol commented Feb 12, 2026

If the script sets r, it should already be assumed to be text, this is only a concern when there was no "r"/"rb" specified, no?

@apiraino
Copy link
Contributor

And please @ozankenangungor don't invoke Copilot in this project.

@ozankenangungor
Copy link
Author

Apologies, I won’t invoke Copilot again in this repository.

Regarding the change: my understanding was that the issue aimed to avoid relying on the platform/locale-dependent default encoding, even in text mode. For that reason, I added encoding="utf-8" to existing text-mode open() calls and left binary opens unchanged.

If this is broader than intended, I’m happy to narrow the scope to only the cases where no mode/encoding was specified.

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants