[Lldb-commits] [lldb] [lldb] improve the heuristics for checking if a terminal supports Unicode (PR #168603)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 19 02:44:12 PST 2025


================
@@ -472,3 +472,18 @@ bool TerminalState::TTYStateIsValid() const { return bool(m_data); }
 bool TerminalState::ProcessGroupIsValid() const {
   return static_cast<int32_t>(m_process_group) != -1;
 }
+
+bool TerminalSupportsUnicode() {
+  static std::optional<bool> result;
+  if (result)
+    return result.value();
+#ifndef _WIN32
+  if (const char *lang_var = std::getenv("LANG"))
+    result = std::string(lang_var).find("UTF-8");
----------------
DavidSpickett wrote:

I'm not sure how this works. Shouldn't it be `.find("UTF-8") != std::string::npos`?

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


More information about the lldb-commits mailing list