Skip to content

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

Open

Description

@seyeeL

Version: es.exe 1.1.1.39 (x64), Everything 1.4.1.1030, Windows 11 (system ANSI code page 936 / GBK)

Problem

When es.exe writes to a pipe instead of a real console (for example under Git Bash / mintty, or when output is captured by another program), non-ASCII file names come out in the system ANSI code page. On a Chinese system that is GBK, so tools expecting UTF-8 show mojibake:

$ es -n 1 示例 | cat
C:\example\ʾ��

The undocumented -cp 65001 option fixes it:

$ es -cp 65001 -n 1 示例 | cat
C:\example\示例

But it has to be typed on every call. es -cp 65001 -save-settings prints "Settings saved.", yet the code page is not written to es.ini. Looking at src/es.c, _es_cp is initialized from GetConsoleCP() and _es_save_settings_with_filename() does not include it, so there is currently no way to make UTF-8 the default.

Request

Any one of these would solve it:

  1. Save -cp / -code-page with -save-settings and read it back from es.ini.
  2. Default to UTF-8 (65001) when stdout is not a console (pipe or file), or offer an option such as -utf8 for that.
  3. At minimum, document -cp in es -h and the README.

Thanks for es, it is very useful for scripting and AI coding agents.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions