Encoding woes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Encoding woes

Alan Schmitt
Hello,

I'm using Vim on a Mac, and everything was going well until I had to
edit some files encoded in mac-roman. My default encoding is utf-8, so
when I load such a file, I do not see the accents (I get some question
marks instead, and the status line indicates [converted]). So to edit
things correctly, I do a:
set encoding=macroman
but then I get something weird: every accent has a strange character
right before it, as in:
prs

How can I use macroman without having these strange character appear?

Thanks a lot,

Alan Schmitt

PGP.sig (193 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Encoding woes

Alan Schmitt
Le 26 mai 05, à 08:58, Alan Schmitt a écrit :

> Hello,
>
> I'm using Vim on a Mac, and everything was going well until I had to
> edit some files encoded in mac-roman. My default encoding is utf-8, so
> when I load such a file, I do not see the accents (I get some question
> marks instead, and the status line indicates [converted]). So to edit
> things correctly, I do a:
> set encoding=macroman
> but then I get something weird: every accent has a strange character
> right before it, as in:
> prs
>
> How can I use macroman without having these strange character appear?
Investigating a little more, it seems that if I do:
open the file
set enc=macroman
:e
then I get what I want.

Is the required extra ":e" a bug?

Thanks,

Alan Schmitt

PGP.sig (193 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Encoding woes

Marian Csontos
'encoding' is for internal encoding only,
you have to change 'fileencoding' what is achieved by:
:e ++enc=macroman filename

Regards
-- Marian

> Investigating a little more, it seems that if I do:
> open the file
> set enc=macroman
> :e
> then I get what I want.
>
> Is the required extra ":e" a bug?
>
> Thanks,
>
> Alan Schmitt


________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com
Reply | Threaded
Open this post in threaded view
|

Re: Encoding woes

Alan Schmitt
Le 26 mai 05, à 15:31, Marian Csontos a écrit :

> 'encoding' is for internal encoding only,
> you have to change 'fileencoding' what is achieved by:
> :e ++enc=macroman filename

Thanks a lot, this did the trick.

Alan

PGP.sig (193 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Encoding woes

A.J.Mechelynck
In reply to this post by Alan Schmitt
Alan Schmitt wrote:

> Le 26 mai 05, ? 08:58, Alan Schmitt a ?crit :
>
>> Hello,
>>
>> I'm using Vim on a Mac, and everything was going well until I had to
>> edit some files encoded in mac-roman. My default encoding is utf-8, so
>> when I load such a file, I do not see the accents (I get some question
>> marks instead, and the status line indicates [converted]). So to edit
>> things correctly, I do a:
>> set encoding=macroman
>> but then I get something weird: every accent has a strange character
>> right before it, as in:
>> pr??s
>>
>> How can I use macroman without having these strange character appear?
>
>
> Investigating a little more, it seems that if I do:
> open the file
> set enc=macroman
> :e
> then I get what I want.
>
> Is the required extra ":e" a bug?
>
> Thanks,
>
> Alan Schmitt

Try the following:

----- for a single file:

in your vimrc
        if &termencoding == ""
                let &termencoding = &encoding
        endif
        set encoding=utf-8

then later:
        :e ++enc=macroman filename
etc.

----- if most of your files are in macroman:

in your vimrc
        if &termencoding == ""
                let &termencoding = &encoding
        endif
        set encoding=utf-8 fileencodings=ucs-bom,utf-8,macroman

then later:
        :e filename
etc.

see (among others)
        :help ++opt
        :help 'fileencodings'

HTH,
Tony.