[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:11 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");
+ else
+ result = false;
+#else
+ result = std::getenv("WT_SESSION") != nullptr;
----------------
DavidSpickett wrote:
I would invert the condition and swap the code so you have:
```
#ifdef _WIN32
...
#else
linux stuff
```
I find that easier to read.
https://github.com/llvm/llvm-project/pull/168603
More information about the lldb-commits
mailing list