TagStudio icon indicating copy to clipboard operation
TagStudio copied to clipboard

fix: call ripgrep with explicit utf-8 encoding.

Open Sola-ris opened this issue 2 months ago • 0 comments

Summary

Call ripgrep with explicit UTF-8 encoding to prevent issues with multi-byte characters.

When calling subprocess.Popen, (which is where silent_subprocess::silent_run eventually ends up) with text=True without specifying the encoding, python will use the encoding returned by locale::getencoding.

On Linux this returns UTF-8 while on Windows it will return cp1252 which causes issues with multi-byte characters like em dashes or Japanese characters. linux win

Fixes https://github.com/TagStudioDev/TagStudio/issues/1195.

Before

before

I've omitted こんにちは.txt from the screenshot since it hangs the program with the error reported in https://github.com/TagStudioDev/TagStudio/issues/1195

After

after

Tasks Completed

  • Platforms Tested:
    • [x] Windows x86
    • [ ] Windows ARM
    • [ ] macOS x86
    • [ ] macOS ARM
    • [x] Linux x86
    • [ ] Linux ARM
  • Tested For:
    • [x] Basic functionality
    • [ ] PyInstaller executable

Sola-ris avatar Nov 11 '25 21:11 Sola-ris