Repository navigation
0.4.6: the text another program writes, as UTF-8 - #26
Merged
Merged
Conversation
mcpplibs.os.text decodes a program's text by the encoding it writes in: UTF-8, or the convention of Windows console programs, which write to a pipe or a file in the output code page of the console they are attached to and in the system's ANSI code page when attached to none, as measured with cl.exe and link.exe (mcpp-community/mcpp#970). The page is read where the program is started; a sequence that is no character of it becomes a replacement character, and valid_utf8 replaces each sequence that is not UTF-8 with U+FFFD, a maximal subpart at a time. windows::console_text_code_page and windows::utf8_from_code_page are the facts beneath it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mcpplibs.os.text decodes the text a started program writes into UTF-8 by the encoding it writes in: utf8, or console, the convention of Windows console programs, which write to a pipe or a file in the output code page of the console they are attached to and in the system's ANSI code page when they are attached to none. Measured with cl.exe and link.exe on windows-2022 (mcpp-community/mcpp#971, run 44508574496): under consoles in 437, 1252, 936 and 65001 each wrote in the console's page, with no console in the system's 1252. The page is read where the program is started, which the program inherits; a sequence that is no character of the page becomes a replacement character, and valid_utf8 replaces each sequence that is not UTF-8 with U+FFFD, a maximal subpart at a time. windows::console_text_code_page and windows::utf8_from_code_page are the two facts beneath it. mcpp uses it to read the text of MSVC tools (mcpp-community/mcpp#970). The tests run on every target, the conversions of the probe's bytes on Windows.