Genivia / ugrep

NEW ugrep 7.1: a more powerful, ultra fast, user-friendly, compatible grep. Includes a TUI, Google-like Boolean search with AND/OR/NOT, fuzzy search, hexdumps, searches (nested) archives (zip, 7z, tar, pax, cpio), compressed files (gz, Z, bz2, lzma, xz, lz4, zstd, brotli), pdfs, docs, and more
https://ugrep.com
BSD 3-Clause "New" or "Revised" License
2.66k stars 111 forks source link

Error in passing file name with Non-ASCII characters to the editor #436

Closed mrkingmidas closed 1 week ago

mrkingmidas commented 3 weeks ago

In TUI, pressing F2 transmits an incorrect file name if it contains non-ASCII characters. Tried without success:

Windows 10 21H1, lang: ru, codepage: 866

genivia-inc commented 2 weeks ago

The filename is just passed "as is" UTF-8 encoded to the command to execute, with the filename surrounded in double quotes ("). Because system() expects a regular character string, it should also accept it in UTF-8. Surprised this is not the case, apparently, which is due to Windows' clunky _system() call, and the use of code pages in this case I assume. There is also _wsystem() that might work. I will experiment with that and see what happens.

genivia-inc commented 2 weeks ago

Ok. That works with a Chinese-named file to view with the more command. I have not tried setting a code page, but it should work now with _wsystem().