[llvm] [llvm-strings] Add --encoding={s,S,u} option (PR #221794)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 01:14:38 PDT 2026


================
@@ -0,0 +1,28 @@
+## Show that llvm-strings uses the specified encoding.
+
+RUN: echo a > %t
+RUN: echo ab >> %t
+RUN: echo abc >> %t
+RUN: echo abcd >> %t
+RUN: echo abcd€ >> %t
----------------
jh7370 wrote:

Use `printf` and octal byte sequences for the non-ascii characters. Otherwise, the encoding of the Euro sign will vary depending on the encoding of this file (in particular, if this file is saved on Windows it's likely to be in local code page encoding, instead of UTF-8 for Linux users).

I'd also be inclined to put some characters after the Euro case. Perhaps have an additional line `abcd€fg` or similar? This will ensure that subsequent characters and strings are still decoded properly.

https://github.com/llvm/llvm-project/pull/221794


More information about the llvm-commits mailing list