Hi all!
I have my OpenSuse 11.1 box set up with utf-8, however, every time I try to open a file with utf-8 characters with vi it can’t handle those characters properly.
What’s might be the problem?
Thanks.
Hi all!
I have my OpenSuse 11.1 box set up with utf-8, however, every time I try to open a file with utf-8 characters with vi it can’t handle those characters properly.
What’s might be the problem?
Thanks.
How do you know that the characters in the file are encoded in UTF-8? Have you tried doing an octal or hex dump of the file to check if perhaps the encoding is actually Latin-1?
For example, I have a file with just the € character and newline. Here’s what it contains:
$ hexdump -C euro
00000000 e2 82 ac 0a |....|
00000004
When we start from the point that the system can not “know” if the file is UTF-8 from the outside. My experience is that vi does a very good guess normaly. That means when it finds out that a file contains bytes that cn not exist in UTF-8 encoded text it reverts to e.g. latin1. But when it is UTF-8 ots normaly treats it as that.
Are you sure your file is UTF-8 encoded Unicode? How did you prove that to yourself?
Hi hen_yap!
Thanks for your reply.
In fact I don’t even need to open a document. If I start a new file on vi, I’m unable to type properly the accentuated characters.
When you can not type accentuated characters, that has nothing to do with vi, but with your keyboard. How do you try to generate things like á, etc?
And to see what the vi thinks about the encoding of the current document, use the command
:set
Hi hcvv!
Thanks for your reply.
My leyboards are fine, they work properly, but your remark made me discover the source of the problem :).
I’m using vi connected to the box via putty (therefore I’m using windows:shame:, and here I can type things like á, so keyb is fine).
Then I decided to try the server’s keyboard to see if it works properly and I found out that, after all, everything works fine there. I can create, view and edit files on vi with accentuated characters.
So my problem must be on some putty config that changes thins between my laptop and the server.
Anyone had to deal with this before?
Thanks.
SOLVED!!!
I found where to solve this.
In putty configurations I went to “Window -> Translation” and changed the “Received data assumed to be in which character set:” parameter.
Thanks for your time