question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Possible locale issue: jc -a and jc -v don't work when LANG=C on Debian Buster

See original GitHub issue

I’ve installed the latest version of jc using the deb on Debian Buster using this Ansible role:

which jc
/usr/local/bin/jc

dpkg -L jc
/.
/usr
/usr/local
/usr/local/bin
/usr/local/bin/jc
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/jc.1
/usr/share/doc
/usr/share/doc/jc
/usr/share/doc/jc/changelog.gz

zgrep jc /usr/share/doc/jc/changelog.gz
jc (1.18.6-1) whatever; urgency=medium

And things like jc ls work without an issue, but jc -a doesn’t when LANG=C:

export LANG=C && jc -a
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "jc.cli", line 417, in main
UnicodeEncodeError: 'ascii' codec can't encode character '\xa9' in position 366: ordinal not in range(128)

Nor does jc -v:

export LANG=C && jc -v 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "jc.cli", line 429, in main
UnicodeEncodeError: 'ascii' codec can't encode character '\xa9' in position 55: ordinal not in range(128)

With LANG=en_GB.UTF-8 there isn’t a problem:

export LANG=en_GB.UTF-8 && jc -v
jc version 1.18.6
https://github.com/kellyjonbrazil/jc
© 2019-2022 Kelly Brazil

This isn’t the behaviour expected based on the documentation, could it be something odd with my setup? I have tested this locally and on a remove development server both as a regular user and as root and the results are consistent.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
kellyjonbrazilcommented, Apr 27, 2022

cool, making some final touches and will release as v1.18.8 in the next day or so.

1reaction
kellyjonbrazilcommented, Apr 26, 2022

Think I have this working in master now. The best way to test would be to clone the master branch and pip install from there. The behavior is pretty inconsistent, at least in my testing. Sometimes I can get the copyright character to generate the exception, and other times (say when inserting the copyright character into a k/v or csv parser input) no exception is generated and the character prints just fine with C locale. Strange.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Locale - Debian Wiki
Run the command locale -a to verify the list of available locales; note that the spellings change. If you've upgraded to Lenny and...
Read more >
Problem of Can't set locale; make sure $LC_* and $LANG are ...
Debian ships locales in source form. They need to be compiled explicitly. The reason for this is that compiled locales use a lot...
Read more >
How to install/change locale on Debian? - Server Fault
I remember that setting LC_ALL on my Ubuntu desktop system works fine. Do I need to install extra packages to make this work,...
Read more >
How do I fix my locale issue? - Ask Ubuntu
First run locale to list what locales currently defined for the current user account: $ locale LANG=C LANGUAGE= LC_CTYPE=fi_FI.
Read more >
Installing Home Assistant Supervised on Debian 11
Using Debian 11 and following a strict set of guidelines available HERE will give you an officially supported installation of Home Assistant ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found