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

After exiting the program, the code page remains 65001 #437

Closed mrkingmidas closed 1 week ago

mrkingmidas commented 1 week ago

How to repeat:

UGrep 7.0.3

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

mrkingmidas commented 1 week ago

Demo in ConEmu, but on native cmd.exe same effect

genivia-inc commented 1 week ago

Perhaps ugrep should only set the console output CP to UTF-8 and reset it afterwards to whatever it was. All output is in normalized UTF-8. When using CP 866, the keyboard input with cmd.exe still works fine for me.

genivia-inc commented 1 week ago

Try this update of ugrep.exe and ug.exe.

genivia-inc commented 1 week ago

Let me know if this minor update (see link above) resolved the issue (it does on my end).

mrkingmidas commented 1 week ago

Let me know if this minor update (see link above) resolved the issue (it does on my end).

Yes , thank you, codepage retruns to initial!

There is an unusual thing (I didn’t find why or influence on anything) - the text “Code page” before is written “localized”, and after the program it is already in “English”. If you manually set your code page to 866, it returns “as it was.”

Example

But it doesn't seem to affect anything.

genivia-inc commented 1 week ago

No idea what's going on with switching languages here. Ugrep doesn't change it. It only sets UTF-8 as the output mode so the UTF-8 normalized output looks fine in the TUI, then ugrep switches back to the old code page when it exits.

One remaining bit of worry I have is about the input code page. Whatever I try on my machine with the ugrep TUI, I don't see any effect of changing the keyboard input code page to UTF-8 (in ugrep's TUI logic), from the current e.g. from 437 or 866. It looks like there is no need to set the input code page to UTF-8, but I could be wrong. Is there something special on non-English Windows installs that show up wrong when using the ugrep TUI text entry with the ugrep 7.0.4 pre-release?

mrkingmidas commented 1 week ago

Is there something special on non-English Windows installs that show up wrong when using the ugrep TUI text entry with the ugrep 7.0.4 pre-release?

No, I haven’t seen anything like this at the moment.