Re: Character encoding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Björn Persson wrote:
> There's a whole set of environment variables that control the locale. The 
> command "locale" displays them all, but normally you'd just set LANG. You 
> should probably define LANG for the whole system in /etc/sysconfig/i18n.
> 
> I don't know Vim but I'd guess that it uses the locale encoding as a default.

Firstly, Red Hat spent quite some time getting Red Hat Linux (the
predecessor of Fedora) to work well with UTF-8, and to use this as a
default. If you haven’t done anything to change how Fedora encodes text,
the chances are that it’s encoded as UTF-8 (or US-ASCII, which is the
common subset to UTF-8 and most Western encodings).

Secondly, for Canadian French and English, you’d probably get away well
with Latin 1 (= ISO-8859-1), which should contain all the characters you
need¹.

Thirdly, the main encoding variables within vim are encoding,
fileencoding, and fileencodings. You can do
:help fileencoding
while within Vim to look at the documentation for each of these. As I
understand it, though, “encoding” is what Vim uses while you’re editing
the current file, “fileencoding” is the character set Vim thinks the
current file on disk is using (and what it will use to write the current
file to disk), and “fileencodings” is a list of encodings that Vim will
try when opening a file to guess which encoding is right. The default
seems to be
ucs-bom,utf-8,latin1
which means “look for a Unicode Byte-Order Marker to see if it looks
like UTF-16, otherwise see if it works as UTF-8, otherwise try Latin 1”.

So if you edit a Latin 1 file with Fedora Vim, you’re likely to see
[converted] messages on opening and saving, encoding will be utf-8 (so
you can type Unicode characters), and fileencoding will be latin1.

You can check each setting with
:set fileencoding
(or the appropriate variable), and set them with something like
:set fileencoding=latin1

Hope this helps,

James.

¹ The main exceptions are the Euro sign, and typographic punctuation
such as “proper” quotes. If you want to enter these easily in Vim, may I
recommend you look at UniCycle?
http://www.vim.org/scripts/script.php?script_id=1384

-- 
E-mail:     james@ | If infinite rednecks fired infinite shotguns at an
aprilcottage.co.uk | infinite number of road signs, they’d eventually
                   | create all the great literary works of the world.
                   | In braille.

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux