Display accented letters in iTerm2 - vim

When I type accented letter in iTerm2, I get a strange behaviour. For instance when i type "sélectionner", iTerm2 displays "sé lectionner".
Preferences/Profiles/Terminal/Character Encoding is set to Unicode (UTF-8).
Any idea of what I should do to have iTerm2 display characters correctly?
Thanks

Make sure "prefs>profiles>text>treat ambiguous-width characters as double-width" is turned off.
See also this issue.

Related

When attempting to specify handling of whitespace characters in vim, how does one figure out character-encoding specifiers, and then implement them?

I'm trying to specify how to display whitespace characters in vim. I've seen a lot of suggestions, and am trying to use this:
:set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:»
But I'm getting E474: Invalid argument: listchars=tab:\~F~R\ ,space:·,nbsp:~P,trail:~#,eol:¶,precedes:«,extends:». I'm pretty sure the text encoding isn't right (Am I even saying that right?).
I'm guessing I have to cast the character type? Or something? How does one find out what encoding is needed, then how do they specify it correctly in .vimrc?
Thank you so much for your time.
How does one find out what encoding is needed, then how do they specify it correctly in .vimrc?
The command is called :help. The only command every Vim user must know.
From :h 'listchars':
The characters ':' and ',' should not be used. UTF-8 characters can be used when 'encoding' is "utf-8", otherwise only printable characters are allowed. All characters must be single width.
So either you're using encoding different from UTF-8, or some outdated Vim version.

vim doesn't display cp1252 characters

I'm running gvim, under Windows. I pasted some text from a web page but vim does not display the hyphen and smart quotes.
When I check the encoding that vim is using (:set enc) vim reports that it is using cp1252.
When I check the hex value of the codes under the cursor (ga) vim reports the correct cp1252 code values (0x96, 0x93, and 0x94).
And yet it does display the smart single quotes (0x91 and 0x92)
Can anyone explain what is happening?
Thanks,
Steve
The "DejaVu_Sans_Mono" and "Lucinda_Console" fonts both displayed the characters with codes between 0xA0 and 0x9F correctly. There are probably others that do so as well. I'm using gvim, so I selected them from the menubar (Edit/Select Font). Subsequently I added the line "set guifont=DejaVu_Sans_Mono:h12" to my _vimrc file. The "h12" specifies font size. – justerman

Is there a way to display a vertical arrow character in a linux terminal using ncurses?

I'm trying to reproduce an old GUI screen in my application that uses ncurses for terminal display. The old GUI used characters that looked like this:
Is there a special ASCII code or other mechanism to do this with ncurses?
There are the alternate character set characters ACS_UARROW and ACS_DARROW, which you can display with addch and related functions, but what character they display depends on your terminal type.
You can use the arrows in unicode, here you can find a list of unicode arrows and the relative codes.
ncursesw has the support to wide character set, you should just set the locale:
setlocale(LC_ALL, "")
If your terminal is unicode aware, your font can display unicode and your locale is set to unicode, you should be able to simply
echo '↑ or ↓'

Vim UTF-8 encoding error on Windows

I have a text file with Polish characters. As long as I do not set :set encoding=utf-8 the characters are not displayed correctly. As soon as I set it to Unicode the characters are displayed but umlauts in error messages in Vim on the other hand are not displayed anymore.
Example:
E37: Kein Schreibvorgang seit der letzten <c4>nderung (erzwinge mit !)
Instead of the <c4> there should be the character Ä displayed. Can anybody explain me why this happens?
I'm experiencing similar issues (you can view some of the questions in my account info, or search for "central european characters" or "croatian characters").
Changing the encoding value changes the way Vim displays the characters - so, the way some of the characters are displayed is changed - that's why you're getting characters. You could probably solve your problem of Polish characters by choosing some other encoding value (one of the cpXXXX for example instead of utf8), but then you would lose the ability to display utf8 characters which can make Vim rather pretty. At least this works for my case (Croatian).
So, either use while writing polish texts one of the cpXXXX encoding values, or stick to utf8 completely. I recommend the first one. But do not change them.
Still working on that here.

Using vim+LaTeX with Scandinavian characters

I want to create a lab write-up with LaTeX in Ubuntu, however my text includes Scandinavian characters and at present I have to type them in using /"a and "/o etc. Is it possible to get the latex-compiler to read these special characters when they are typed in as is? Additionally, I would like vim to "read" Finnish: Now when I open a .tex-document containing Scandinavian characters, they are not displayed at all in vim. How can I correct this?
For latex, use the inputenc option:
\usepackage[utf8]{inputenc}
Instead of utf8, you may use whatever else fits you, like latin1, as well.
Now the trick is to make your terminal run the same character encoding. It seems that it runs a character/input encoding that doesn't fit your input right now.
For this, refer to the "Locale" settings of your distribution. You can always check the locale settings in the terminal by issueing locale. These days, UTF8 locales are preferred as they work with every character imaginable. If your terminal's environment is set up correctly, vim should happily work with all your special characters without mourning.
To find out in which encoding Vim thinks the document is, try:
:set enc
To set the encoding to UTF-8, try:
:set enc=utf8
I can't help with vim, but for LaTeX I recommend you check out XeTeX, which is an extension of TeX that is designed to support Unicode input. XeTeX is now part of Texlive, so if you have TeX installed chances are you already have it.
I use the UCS unicode support: http://iamleeg.blogspot.com/2007/10/nice-looking-latex-unicode.html

Resources