I have an ssh connection to the ubuntu 20.04 server using iterm2 from MacOS BigSur.
In this situation, I am suffering from garbled characters "only some command output".
Specifically, it's an ls command, but
$ls
test '$'\343\203\206\343\202\271\343\203\210'
Strangely enough, if you pipe this output to another command, it will not cause garbled characters.
$ls|cat
test
test
The server is set to LANG=en_US.UTF-8
as it is touched by a multinational team.
However, the behavior did not change even after setting the LANG variable as shown below.
$LANG=ja_JP.UTF-8ls
test '$'\343\203\206\343\202\271\343\203\210'
As for the cat command, I can display the files in Japanese correctly, but
$cat README.md
* for laboratory internal development
...
The nano command displays all Japanese in a strange way.
$nano README.md
^t^f^e^c^v^k^y^t
...
The vi command is garbled again, and some Japanese characters are visible.
$vi README.md
~T Laboratory �~F~E �~C �~V~K �~Y �~T �
...
I'm having a hard time dealing with a very rare symptom, but
Consolidate the configuration of these different set of commands.
Is there a way to always display Japanese correctly?
The contents and file name of the file are all UTF-8 only.
A machine is an environment where only Linux and Mac exist.
Several additional validations have been made
·Exactly the same symptom in MacOS standard terminal.app
It doesn't seem to be a symptom peculiar to iterm2
·The exa command you added will not be garbled
Are exa and cat loading any different settings than OS standard ls commands and nano?
·Error in output of locale command
locale:Cannot set LC_CTYPE to default locale:No such file or directory
locale:Cannot set LC_ALL to default locale:No such file or directory
LANG = en_US.UTF-8
LANGUAGE=
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
I searched the error message of the locale
command above and found this article.
https://askubuntu.com/questions/599808/cannot-set-lc-ctype-to-default-locale-no-such-file-or-directory
Turn off the automatic setting of the locale variable in iterm2 as shown in the attached image.
After restarting itterm2, the error disappears from the result of the locale command and
ls nano vi
All now display Japanese correctly
© 2024 OneMinuteCode. All rights reserved.