Skip to content

Save -cp / -code-page with -save-settings (fixes #13) - #14

Open
hrid0yyy wants to merge 1 commit into
voidtools:mainfrom
hrid0yyy:fix/save-settings-code-page
Open

hrid0yyy wants to merge 1 commit into
voidtools:mainfrom
hrid0yyy:fix/save-settings-code-page

Conversation

@hrid0yyy

@hrid0yyy hrid0yyy commented Nov 7, 2026

Copy link
Copy Markdown

Title: Save -cp / -code-page with -save-settings (fixes #13)

Fixes #13.

Problem

es -cp 65001 -save-settings prints "Settings saved." but the code page is never written to es.ini, so UTF-8 output has to be requested on every call. Without it, non-ASCII file names come out as ? or mojibake when output is piped (Git Bash, scripts, other programs).

Change

  • New _es_cp_setting (same pattern as argv_mode): 0 = use the console code page (the current default behaviour).
  • -cp <n> sets it; -save-settings writes code_page=<n> to es.ini; _es_load_settings applies it when it's non-zero.
  • A -cp on the command line still overrides the saved value, and -export-m3u still forces CP_ACP.
  • -cp 0 -save-settings restores the default.
  • Documented -cp / -code-page in es -h and the README (option 3 in the issue).

Existing es.ini files have no code_page key, so they read as 0 and behave exactly as before.

Testing

Built x64 Release (MSVC 14.51) from main and from this branch, then ran both against Everything 1.4 with a file named zqx示例ফাইল.txt, piping the output and checking for the exact UTF-8 bytes:

Case main this branch
no settings zqx??????.txt zqx??????.txt (unchanged)
-cp 65001 on the command line UTF-8 ✔ UTF-8 ✔
after -cp 65001 -save-settings, no -cp zqx??????.txt ✘ UTF-8 ✔
saved 65001, then -cp 437 on the command line — ? (command line wins) ✔
after -cp 0 -save-settings — default restored ✔

es.ini after saving contains code_page=65001.

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.

Feature request: allow -save-settings to persist -cp (UTF-8 output when piped)

1 participant