Terve Tuomas :)

On Fri 22 May 2009 21:35 +0200, Tuomas Pyyhtiä <[email protected]> dixit:
> On Fri, 22 May 2009 21:07:15 +0300, Raúl Núñez de Arenas Coronado 
> <[email protected]> wrote:
>
> Terve Raúl!

Thanks! I didn't know how to say "hello" in Finnish (I had to Google
"terve") :)))))

> And for the time being, I'm going to add cp1250 to filencodings in my
> .gvimrc and make a mental note it's there.

Remember, as long as "cp1250" is *before* latin1 in fencs, it is like
latin1 is not even there, since cp1250 will always succeed.

>> The problem is that, in that Vim session, if you open a latin1 file
>> it will be opened using cp1250, so I prefer the first method I told
>> you, using ":e ++enc".
>
> And I thought all the time this *was* a latin-1 encoded file (as this
> is the encoding my friend uses, and I think Vim win32 binaries are
> compiled with that encoding enabled by default.)

I've been there, too: I've got many files from friends with 0x92 in them
(I think it is a single quote) but I insisted on opening them as
"latin1", which they weren't. I almost never think of cp1250 :(

> Few questions: How am I able in the future to define what encoding the
> file uses? i.e. How did you see what encoding to enforce? Do I have to
> make my best guess and blindly enforce different encodings and proof
> read the file  every time, or what's the best approach solving
> encoding horrors if I ever get into them again?

If you mean forcing the encoding *before* reading the file, then ":e
++enc=encoding" within vim, and the trick using "--cmd" are the only
solutions I know.

If you mean *changing* the encoding, which in turn mean *converting* the
file, you can use ":set fenc=encoding", but please note that this will
convert the file from the detected encoding (latin1 in your example) to
encoding "encoding". For example, converting your example using ":set
fenc=utf-8" won't work as expected, because it will convert from latin1
to utf-8, not from cp1250 to utf-8.

On the other hand, if you know the encoding in advance and don't want to
use the "--cmd" trick or ":e ++enc" (I must confess I forget this one
almost always), then you can use "iconv". That's what Vim uses
internally (well, in library form I think) and works perfectly.

I'm by no means a Vim encoding expert, and I had a hard time back when I
started to use Vim with "encoding" and "termencoding", because I worked
with utf-8 files but I have a latin1 Linux system. This said, feel free
to ask whatever you need about this issue, and let's see if I know how
to solve it O:) Fortunately, people in this list are very clever, so if
I make a mistake someone will correct me.

-- 
Raúl "DervishD" Núñez de Arenas Coronado
Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to