Cyrillic symbols in Linux file names

2

I have a Linux, made by Buildroot tool.

And I faced with a problem with creating files with cyrillic names. When I try to create a file, for example with such command:

touch файл.txt

I get a file, named like ????.txt.

I tried to export LANG variable:

# export LANG=ru_RU.utf8
# echo $LANG
ru_RU.utf8

And I also tried to create the file in /temp directory and at an EXT3 partition, but the result is the same.

In general, I can use cyrillic in the system: programs can print them, and I can use cyrillic symbols in programs (like in vi, for example).

What else can I try to do?

Антон Наземных

Posted 2019-09-06T08:25:45.877

Reputation: 21

1Do you have ru_RU.utf8 in the locale -a list? If not, do you have any other .utf8 locale at all? (It doesn't need to be ru_RU as long as it's UTF-8.) – user1686 – 2019-09-06T08:27:25.587

Are you sure the actual name created is ???? or might it be the tool you’re using? – Wildcard – 2019-09-06T08:28:44.867

Answers

1

touch did create the file name correctly. But ls is not displaying it. That's because ls by default displays question marks for anything that is doesn't recognize as a printable character.

You can test this by using another command to display the contents of the directory. Try any of the following commands:

$ ls --show-control-chars
$ sh -c 'echo *'
$ python3 -c 'import os; print(os.listdir("."))'

Setting $LANG to a UTF-8 locale, as you did when you typed export LANG=ru_RU.UTF-8, should have fixed the problem. Since that didn't work, check

  • If LC_CTYPE has been set, it will override the value of LANG.
  • Has your system be installed with Russian-language support? If not, use another supported locale such as en_US.UTF-8.

AndyB

Posted 2019-09-06T08:25:45.877

Reputation: 71