crouton shell unicode

Created on 19 Mar 2013  ·  17Comments  ·  Source: dnschneid/crouton

This does not relates to crouton directly, as far as I understand:
am I right, that there is no support for unicode if I login via build-in chromium terminal? I just realized that I can read/write text in cyrilic in bash shell within crouton ... What a pity ...

bug duplicate

Most helpful comment

sh Downloads/crouton -r stretch -t core   # ... is how I installed crouton
sudo enter-chroot               
sudo apt-get install locales    
sudo dpkg-reconfigure locales   # ... and selected de_DE.UTF-8
echo >>~/.bashrc export LANG=de_DE.UTF-8
echo >>~/.bashrc export LC_ALL=de_DE.UTF-8
echo >>~/.bashrc export LANGUAGE=de_DE.UTF-8

This fixed the missing UTF-8 for me.
Though .profile might have been a better place to set the environment.

All 17 comments

login via 'secure shell' extension to chrome solves half of the problem. It looks however that vim within chroot crouton does not support unicode.

I think people were having success with setting the LANG environment variable; e.g. export LANG=en_US.UTF-8, replacing en_US if you want your language to be something else.

May I ask (another) stupid question: where can I get the list of all supported LANG values for chromeos?

Not a stupid question! You're actually looking for the Ubuntu LANG values; they're listed in /usr/share/i18n/SUPPORTED in the chroot.

Looks like I am a bit lost. May I ask you for extra advise, David? I tried both
export LANG=ru_RU.UTF-8 && sudo enter-chroot -n beetle
... and within crouton
export LANG=ru_RU.UTF-8 && bash

and it doesn't seem work for me. In vim under crouton text file with string in russian

текст по-русски

looks like

�~Bек�~A�~B по-�~@�~C�~A�~Aкиgot it?

Shall I blame the lack of fonts?

... continuing
It appears that I also have problem with other (ANSI?) characters: NERDtree for VIM does spit unreadable characters in crouton bash:


. (up a dir)
/home/dimonf/.vim/bundle/
�~V� nerdtree/

Is this the crosh shell or a terminal inside of a crouton UI?

Whoops, that was actually a stupid question (you already said it was crosh). It looks to me like crosh doesn't properly handle unicode (see bugs; I'm sure there are others as well). Does this seem to match what you're seeing? You'll probably need to install a DE (xfce, for instance) and use a terminal from inside there in order to get things displaying properly.

David thank you for paying attention.

I did the following tests:
I. I started up chroot via

sudo enter-chroot -n my_distro

... end within crouton started ssh server via

sudo /etc/init.d/ssh start

after that I leave this terminal alone.

II. In chromeos I launch secure shell plugin:
https://chrome.google.com/webstore/detail/secure-shell/pnhechapfaindjhompbnflcldabbghjo
I've made the app to start in a separate window (right click on the application in the chromeos launcher and select 'open as window') which opens dialog, where one can enter ssh connection details and other settings. I login into crouton this way - to username@localhost.

III. This way, test file encoded in utf-8 is readable and all non-ascii chars are OK. Unfortunately, printing those characters via this terminal renders weird result.

IV. I've logged in from the same application into external fedora server and - bingo! - everything works perfectly: both reading and printing non-ascii characters within vim or on command line is done without any problem.

Does ssh server determine the way ssh client / hterm handles non-ascii characters?

So crosh and ssh both use hterm to render the terminal, but the hterm in the ssh app is always up-to-date, vs. crosh which uses the built-in version of hterm and tends to lag behind quite a bit.
Try using the windowed crosh extension, which actually uses the ssh app's hterm to run crosh. Confusing, but that may make things more usable for you without needing to pipe through SSH.

The nth method is to install a DE target (xfce, lxde, or straight-out x11 or xephyr) and use the terminal emulator inside of the chroot to view unicode.

Folding into #85, which is possibly the best we can do.

@dimonf's secure shell idea is definitely the way to go, if you ask me.
Just start sshd with rc.local (great feature, @dnschneid!), and connect to localhost.

ps, I wrote this up here: www.simonmweber.com/2013/04/20/development-on-a-chromebook-an-opinionated-guide.html.

i just want to register my love for whoever came up with the simple and gorgeous solution of connecting to sshd on localhost. <3333 ☂ unicode umbrellas everywhere up in my vim

@chee put 'set encoding=utf8' in your vimrc and you wont need ssh. Works on my acer chromebook 14. ☂☂☂☂☂☂☂

sh Downloads/crouton -r stretch -t core   # ... is how I installed crouton
sudo enter-chroot               
sudo apt-get install locales    
sudo dpkg-reconfigure locales   # ... and selected de_DE.UTF-8
echo >>~/.bashrc export LANG=de_DE.UTF-8
echo >>~/.bashrc export LC_ALL=de_DE.UTF-8
echo >>~/.bashrc export LANGUAGE=de_DE.UTF-8

This fixed the missing UTF-8 for me.
Though .profile might have been a better place to set the environment.

@Jimsy2 You shouldn't need to manually set LANG, LC_*, etc. During the "reconfigure" step, it asks what your default LANG type should be. All you need for that variable and the rest to be set is to exit the crouton chroot and re-enter it. In your case, you'll get what you expect if you selected de_DE.UTF-8 when asked for your desired default on the second screen.

@tangentsoft You are right regarding that LANG is set by dpkg-reconfigure locales and that I should have restarted Crouton to apply the changes. I used source ~/.bashrc to apply the changes made to .bashrc instead which is not so nice.

Therefore I added the missing variables to /etc/default/locale now:

(stretch)jimsy@localhost:~$ cat /etc/default/locale 
#  File generated by update-locale
LANG=de_DE.UTF-8
#  added manually
LC_ALL=de_DE.UTF-8
LANGUAGE=de_DE.UTF-8
Was this page helpful?
0 / 5 - 0 ratings

Related issues

killshot13 picture killshot13  ·  3Comments

tedm picture tedm  ·  3Comments

Taylormsz picture Taylormsz  ·  5Comments

shichuzhu picture shichuzhu  ·  5Comments

wymby picture wymby  ·  6Comments