1

Specifically, I have encountered this issue with the lowercase a with an umlaut ä and the lowercase scharfes s ß. Their (extended) ASCII values are 0xDF and 0xE4, respectively:

(extended) ASCII table with the relevant characters highlighted

This can be seen, in the lower left corner, by invoking

:set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P

I insert the characters in one git-bash terminal shell, and both characters look the same upon opening the file again (in the same shell):

Opened in the same shell, characters show no change screenshot

When I open the same file in a different shell, the two characters are changed to äd and Ã~_ , respectively. In the second case Ã~_, however, Vim points out that ~_ is actually the character Ÿ; since it recognizes it as the 0x9F (extended) ASCII character:

Bad digraphs in different shell example screenshot

I have this same issue with many other extended ASCII characters. Does anybody know what causes these characters to change upon saving and opening in a different shell?

  • check your encoding setting – Christian Brabandt Jun 26 '18 at 8:15
  • @ChristianBrabandt Are you saying that there is an encoding "mismatch" between the output of the terminal and Vim's encoding setting? What could cause this? – Mussé Redi Jun 26 '18 at 8:28
1

As suggested by @ChristianBrabandt, the issue with my minimal working example (MWE, in the post) was solved by changing my encoding to utf-8:

:set encoding=utf-8

However, in my original file, the characters were still displayed incorrectly, even after changing the encoding setting. I had to manually re-insert the characters. Not sure why it worked straight away with my MWE, but not with my original file.

  • Vim converts unrecognized characters automatically. Check +bad on the help. – Spidey Aug 26 '18 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.