Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Check LC_CTYPE to set UTF-8 locale #752

Closed
lcheylus opened this issue Feb 8, 2024 · 0 comments · Fixed by #753
Closed

[BUG] Check LC_CTYPE to set UTF-8 locale #752

lcheylus opened this issue Feb 8, 2024 · 0 comments · Fixed by #753
Assignees
Labels
bug Something isn't working

Comments

@lcheylus
Copy link
Contributor

lcheylus commented Feb 8, 2024

On some OS (especially on OpenBSD), locale are defined only via LC_CTYPE (export LC_CTYPE=en_US.UTF-8) => see https://www.openbsd.org/faq/faq10.html#locales

With this configuration, no UTF-8 locale is detected at start.

Reproduction

  • Define only LC_CTYPE=en_US.UTF-8 for locale
$ unset LANG
$ unset LC_ALL

$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE=en_US.UTF-8
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_MESSAGES="C"
LC_ALL=
  • Error when startting btop:
$ bin/btop
ERROR: No UTF-8 locale detected!
Use --utf-force argument to force start if you're sure your terminal can handle it.

Expected behavior

UTF-8 locale is checked in src/btop.cpp (line 915...). In line 923, I propose to check also LC_CTYPE variable value for UTF-8:

for (const auto loc_env : array{"LANG", "LC_ALL"})

Info:

  • btop++ version: 1.3.0 (last Git version)
  • Binary: self compiled
  • Compiler and version: clang v16
  • Architecture: x86_64
  • Platform: OpenBSD
  • Terminal used: Kitty
@lcheylus lcheylus added the bug Something isn't working label Feb 8, 2024
lcheylus added a commit to lcheylus/btop that referenced this issue Feb 8, 2024
Fix aristocratos#752

Signed-off-by: Laurent Cheylus <foxy@free.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants