Treat cp1252 C1 bytes as Windows‑1252 and coerce non‑UTF‑8 Lua/parsed text to UTF‑8#3
Closed
MjnMixael wants to merge 1 commit into
Closed
Treat cp1252 C1 bytes as Windows‑1252 and coerce non‑UTF‑8 Lua/parsed text to UTF‑8#3MjnMixael wants to merge 1 commit into
MjnMixael wants to merge 1 commit into
Conversation
MjnMixael
added a commit
that referenced
this pull request
Jul 8, 2026
* allow models for intel entries * address feedback
MjnMixael
added a commit
that referenced
this pull request
Jul 8, 2026
* allow models for intel entries * address feedback
MjnMixael
added a commit
that referenced
this pull request
Jul 13, 2026
* allow models for intel entries * address feedback
MjnMixael
added a commit
that referenced
this pull request
Jul 13, 2026
* allow models for intel entries * address feedback
MjnMixael
added a commit
that referenced
this pull request
Jul 13, 2026
* allow models for intel entries * address feedback
MjnMixael
added a commit
that referenced
this pull request
Jul 13, 2026
* allow models for intel entries * address feedback
MjnMixael
added a commit
that referenced
this pull request
Jul 13, 2026
* allow models for intel entries * address feedback
MjnMixael
added a commit
that referenced
this pull request
Jul 13, 2026
* allow models for intel entries * address feedback
MjnMixael
added a commit
that referenced
this pull request
Jul 13, 2026
* allow models for intel entries * address feedback
MjnMixael
added a commit
that referenced
this pull request
Jul 13, 2026
* allow models for intel entries * address feedback
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.
Motivation
guessLatin1Encoding()returned true, which can skip cp1252 C1 bytes (e.g.0x9Cforœ) and leave invalid UTF‑8 sequences that triggerutf8::find_invalid()in the scripting API.Description
contains_windows_1252_extension_bytes(const char*, size_t)incode/parse/parselo.cppto detect bytes in the Windows‑1252 C1 extension range (0x80..0x9F).read_raw_file_text()incode/parse/parselo.cppto use anisLikelyWindows1252heuristic (combiningguessLatin1Encoding()and the new helper) before attempting reencoding, and reencode via Windows‑1252 → UTF‑8 when appropriate.coerce_to_utf8()incode/parse/parselo.cppto attempt Windows‑1252 → UTF‑8 conversion for likely Western text and return early on success, preventing fallthrough truncation of convertible cp1252 input..luafiles incode/scripting/scripting.cppso Lua source is converted to UTF‑8 beforeluaL_loadbufferis called, avoiding invalid byte sequences reachingade_args.cppchecks.#include <cstdint>where needed and preserved/used the previously addedEncoding_windows_1252mapping incode/utils/unicode.*.Testing
git diff --checkto validate formatting and found no issues (success).git status --shortto confirm only intended files were changed (success).Codex Task