How to make vim display unicode

3

1

I am trying to work with a utf-8 encoded xml file in vim 7.3 running on ubuntu. ASCII characters display normally but vim gives me gibberish instead of the unicode characters. After trying the following, I've reached the limits of my knowledge:

1) Checked that unicode was enabled by running set termencoding?. Output was termencoding=utf-8.
2) I installed the script from here (vim.org/scripts)
3) moved my ~/.vimrc file into ~/.vim
4) moved it back into ~
5) followed the instructions in the accepted answer to this question.

Is there some other variable I'm supposed to set? I know my system has the fonts I need.


Update:
Issue seems to be limited to html files for some reason.


Update:
Solved. What I thought was unicode was in fact foreign ANSI

Yitzchak

Posted 2012-04-05T14:43:18.413

Reputation: 4 084

Question was closed 2013-03-25T14:03:23.947

visited 3000 times, but closed as too localized... – duhaime – 2018-06-17T20:49:09.010

1Can tou see UTF-8 in your terminal? Test to e.g. cat a file with Unicode multibyte characters. – Daniel Andersson – 2012-04-05T14:52:26.963

Yes, but not the file I'm trying to work with. Time for a little more testing, thanks. – Yitzchak – 2012-04-05T15:00:50.183

1Try the command file on the file in question to see encoding information. – Daniel Andersson – 2012-04-05T15:03:30.193

That clicked after you told me to check if my terminal could display unicode. It can, and so can vim (alas no right to left support). Issue seems to be limited to html and xml files. Updating question to reflect that. – Yitzchak – 2012-04-05T15:16:12.520

What does ":verbose set fileencoding?" (with the question mark) show when you open an HTML/XML file with utf-8 characters? – Heptite – 2012-04-05T17:24:37.513

Shows fileencoding=utf-8 – Yitzchak – 2012-04-05T17:58:04.390

1You don't need any script. Did you create the *.html files with Vim or with another editor? Did you download them from an FTP server? Do you have set termencoding=utf-8 and set encoding=utf-8 in your vimrc? – romainl – 2012-04-05T21:26:39.823

1What exactly is the "gibberish"? To me it sounds like the file you're working with contains Unicode characters that are not supported by the font that your terminal is using. But in that case the characters are shown as squares with their Unicode value inside. – richq – 2012-07-21T14:54:25.770

No answers