Repository navigation
fix(windows): console output shows characters outside the console's code page - #2106
Conversation
… page on a Windows console When a standard handle is a console, ConsoleOutput replaces the text file's write function: the RTL fills the buffer with UTF-8 and each flush writes the complete characters as UTF-16 with WriteConsoleW. Every Write and WriteLn to the console goes through it, including the CLIs' timing lines and reports. Redirected output stays UTF-8 bytes, and the console's code page is never changed. Closes #1890
…thing per write, leave GUI standard files alone The console write function holds back a split character only when the RTL flushes a full buffer, so Close and the flush at exit write everything. The Windows writer converts UTF-8 to UTF-16 on the stack. ProcessEncoding only changes the standard files of a console application. The test starts its file in code page 850, decodes each writer call on its own, and names the IOResult of a failed write.
…le; docs name the GUI exception
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
test262 Conformance
Areas closest to 100%
Per-test deltas (+0 / -0 / timeout +2 / -0)New timeouts (2):
Steady-state failures and timeouts are non-blocking; PASS → non-timeout failure transitions fail the conformance gate. Measured on ubuntu-latest x64. Areas grouped by the first two test262 path components; minimum 25 attempted tests, areas already at 100% excluded. Δ vs main compares against the most recent cached |
Web Tooling Benchmark
18 pinned Web Tooling workloads; 18 workloads produced at least one Goccia sample. Raw results from 1 sample per workload; full stdout/stderr for failures and min/max/CV stay in the |
AWFY Results
Geomean Ratios
14 pinned AWFY benchmarks. Medians from 5 interleaved samples per engine; raw JSON includes min/max/CV and is attached as the |
JetStream 3 Performance Barometer
Geomean reference ratio: QuickJS 11.58×; Node.js 126.73×. 1.00× means aligned; values above 1.00× mean Goccia was proportionally slower after normalizing JetStream’s higher-is-better score. This is a directional barometer across runtimes with different goals, not a product ranking. Raw samples and failure details remain in the |
Benchmark Results447 benchmarks · PR vs same-runner 🟢 32 improved · 🔴 72 regressed · 343 unchanged · avg -1.6% Typical per-run noise (median variance): ±2.3%. Deltas within noise overlap and read as unchanged. arraybuffer.js — 🟢 1, 🔴 1, 12 unch. · avg +2.8%
arrays.js — 🟢 2, 17 unch. · avg -0.0%
async-await.js — 🔴 1, 5 unch. · avg -2.2%
async-generators.js — 2 unch. · avg +5.5%
atomics.js — 6 unch. · avg +1.8%
base64.js — 🟢 2, 9 unch. · avg +2.3%
classes.js — 🟢 4, 🔴 5, 22 unch. · avg -1.3%
closures.js — 🟢 3, 🔴 1, 7 unch. · avg +3.4%
collections.js — 🟢 1, 🔴 1, 10 unch. · avg -2.8%
csv.js — 13 unch. · avg +0.7%
destructuring.js — 🟢 2, 🔴 4, 16 unch. · avg -3.5%
fibonacci.js — 8 unch. · avg +0.8%
float16array.js — 🟢 1, 🔴 4, 27 unch. · avg -1.9%
for-in/for-in.js — 🟢 1, 2 unch. · avg +12.9%
for-of.js — 🔴 1, 6 unch. · avg -1.2%
generators.js — 4 unch. · avg -1.8%
intl.js — 🔴 1, 5 unch. · avg -2.8%
iterators.js — 🟢 4, 🔴 14, 24 unch. · avg -2.8%
json.js — 🟢 1, 🔴 3, 19 unch. · avg -1.6%
jsx.jsx — 🟢 3, 🔴 7, 11 unch. · avg +0.2%
modules.js — 🔴 1, 8 unch. · avg -3.6%
numbers.js — 🔴 1, 15 unch. · avg -0.0%
objects.js — 🔴 2, 6 unch. · avg -4.8%
promises.js — 🔴 4, 8 unch. · avg -2.6%
property-access.js — 5 unch. · avg -2.5%
proxy.js — 2 unch. · avg +0.1%
regexp.js — 🟢 1, 12 unch. · avg +0.5%
strings.js — 🔴 2, 17 unch. · avg -1.8%
temporal.js — 6 unch. · avg -0.2%
tsv.js — 🟢 1, 8 unch. · avg +0.8%
typed-arrays.js — 🔴 9, 13 unch. · avg -15.6%
uint8array-encoding.js — 🟢 4, 🔴 4, 10 unch. · avg +5.3%
weak-collections.js — 🟢 1, 🔴 6, 8 unch. · avg -7.4%
Deterministic profile diffDeterministic profile diff: no significant changes. Measured on ubuntu-latest x64. Each PR run also builds the |
Suite TimingTest Runner (17,283 passed)
MemoryGC rows aggregate the main thread plus all worker thread-local GCs. Test runner worker shutdown frees thread-local heaps in bulk; that shutdown reclamation is not counted as GC collections or collected objects.
Benchmarks (447)
MemoryGC rows aggregate the main thread plus all worker thread-local GCs. Benchmark runner performs explicit between-file collections, so collection and collected-object counts can be much higher than the test runner.
Boot
Empty-script ( Measured on ubuntu-latest x64. |
|
@coderabbitai review |
Action not completed
|
|
@coderabbitai review |
Action performed
|
Summary
console.logand every other line the CLIs write now show characters outside the console's code page, such as😀or日本語, instead of?. WhenGetConsoleModesucceeds on standard output or error, the text goes out as UTF-16 throughWriteConsoleW. The code page is never changed.OutputCallbackis unchanged, and Linux and macOS don't link the new unit.Closes #1890
Details
ConsoleOutputunit replaces the write function of a standard text file whose handle is a console. The RTL still fills the buffer with UTF-8, and each flush hands its complete characters to a writer that converts them on the stack, so nothing is allocated, and callsWriteConsoleW.ProcessEncodingapplies it toOutput,StdOut,ErrOutputandStdErr.EmitLine: everyWriteandWriteLngoes through the text file, so timing lines, test reports, errors and the REPL are covered without touching a call site.ü,日本語and✓print wheremainprints?. Wine shows any surrogate pair fromWriteConsoleWas twoU+FFFD, so the emoji is unconfirmed.Visual walkthrough
script.js:GocciaRunner script.jsincmd(code page 850)GocciaRunner script.js > out.txtmainü, and?for each character missing from code page 850ü 😀 日本語ü 😀 日本語(subject to the console font)How to test
cmdor PowerShell with the default OEM code page, runbuild\GocciaRunner.exe script.jswith the script above. Expected:ü 😀 日本語, andchcpafterwards prints the same code page as before.build\GocciaRunner.exe script.js > out.txt. Expected:out.txtholds the UTF-8 bytesC3 BC 20 F0 9F 98 80 20 E6 97 A5 E6 9C AC E8 AA 9E 0D 0A../build.pas tests --test=ConsoleOutput.Test --run-tests. Expected: all tests pass.Edit:
ac1e358reviewedci.yml, Windows x64 and i386-win32 included): pending for this head.