Skip to content

lean check: read sources as UTF-8 on every platform - #2097

Merged
ashhart merged 1 commit into
ashhart:mainfrom
BobClawblaw:lean-utf8
Nov 4, 2026
Merged

ashhart merged 1 commit into
ashhart:mainfrom
BobClawblaw:lean-utf8

Conversation

@BobClawblaw

Copy link
Copy Markdown
Contributor

What this changes

tools/zig/lean_check.py now reads sources as UTF-8. Before, it used the locale's encoding, which is cp1252 on Windows, so each multi-byte character counted as two or three columns there and the count differed from Linux and macOS. After, every platform counts the same. lean_new.py already reads as UTF-8.

Checks on this head

Receipt

n/a: a development tool that cannot reach inference.

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency. (No test added: the checker has no tests, and the change is the encoding argument.)
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

@ashhart

ashhart commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Thanks @BobClawblaw. Reading as UTF-8 makes the count the same everywhere, and forcing cp1252 to reproduce the Windows number was a neat way to show it. Ready to land.

Without an encoding, read_text uses the locale's (cp1252 on Windows), so a
multi-byte UTF-8 character counts as several columns there and the count
differs from Linux and macOS.
@ashhart
ashhart merged commit 343e3bd into ashhart:main Nov 4, 2026
7 checks passed
@ashhart

ashhart commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Thank you @BobClawblaw. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

@ashhart

ashhart commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Thanks @BobClawblaw! This is in TensorFold 1.2.3, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.3

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.

lean check counts multi-byte characters as several columns on Windows

2 participants