If I view a file using cat(1) or more(1) or less(1) commands it shows everything correctly, but if I try to view it in vim then it shows garbage instead of Russian characters. The ASCII text looks fine, of course. So, was vim compiled in some special way for Termux which makes it NOT work with UTF-8 text files? If so, that is a very serious limitation and it should be recompiled properly. apt list | grep vim shows that I have 8.1.0500 version of vim and the same version of vim-runtime installed. The version of Termux is the latest, but I have tested on the older ones (with square icon) and the result is exactly the same. Maybe I need something in .vimrc for this to work (but I never needed anything like that, having used vim for "God knows how many years" :)
Ahhh..... someone set the encoding to latin1 for some reason. Surely it should be set to utf8, so adding this line to ~/.vimrc fixes the issue:
set encoding=utf-8
i guess https://github.com/termux/termux-packages/blob/master/packages/vim/vimrc
is the file we should edit here?
line 49
if &encoding ==# 'latin1' && has('gui_running')
set encoding=utf-8
endif
we should enable utf-8 encoding by default since utf-8 is what the bionic libc uses regardless
Thanks for reporting @tigran123 , and good analyzing @its-pointless !
The system vimrc has now been changed to set encoding=utf-8 unconditionally. This change is available in the 8.1.0518 version of the vim package, which is now available for installation.
Most helpful comment
i guess https://github.com/termux/termux-packages/blob/master/packages/vim/vimrc
is the file we should edit here?
line 49
if &encoding ==# 'latin1' && has('gui_running')
set encoding=utf-8
endif
we should enable utf-8 encoding by default since utf-8 is what the bionic libc uses regardless