Skip to content

Commit d02af31

Browse files
docs: Clarify default encoding behavior in documentation (#2693)
* docs: Clarify default encoding behavior and cross-platform considerations * docs: update CLI reference documentation 🤖 Generated by GitHub Actions --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 29a6f5b commit d02af31

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

docs/cli-reference/base-options.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ Specify character encoding for input and output files.
1919
The `--encoding` flag sets the character encoding used when reading
2020
the schema file and writing the generated Python code. This is useful
2121
for schemas containing non-ASCII characters (e.g., Japanese, Chinese).
22-
Default is utf-8.
22+
Default is the system's preferred encoding (via `locale.getpreferredencoding()`),
23+
which is typically UTF-8 on Linux/macOS but may differ on Windows (e.g., cp1252).
24+
For consistent cross-platform behavior, explicitly specify `--encoding utf-8`.
2325

2426
!!! tip "Usage"
2527

tests/test_main_kr.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,9 @@ def test_encoding_option(output_file: Path) -> None:
12841284
The `--encoding` flag sets the character encoding used when reading
12851285
the schema file and writing the generated Python code. This is useful
12861286
for schemas containing non-ASCII characters (e.g., Japanese, Chinese).
1287-
Default is utf-8.
1287+
Default is the system's preferred encoding (via `locale.getpreferredencoding()`),
1288+
which is typically UTF-8 on Linux/macOS but may differ on Windows (e.g., cp1252).
1289+
For consistent cross-platform behavior, explicitly specify `--encoding utf-8`.
12881290
"""
12891291
run_main_and_assert(
12901292
input_path=JSON_SCHEMA_DATA_PATH / "encoding_test.json",

0 commit comments

Comments
 (0)