Many times, specially when writing web pages, you have to deal with texts with different encodes (if web site isn't in us-ascii, of course). Here are some useful tips for not spending too much time with this:
bash# file -i <filename> (for knowing the encoding for a specific file)
vim# :set fileencoding=utf-8 (for changing encoding of current file, converting characters from one charset to the new one in a human understandable way)
vim# :set encoding=utf-8 (for setting encode of new files; default is system locale)
Remember that those thinks just apply to plain files, that are saved without any header or any information about encoding (editors try to figure out encodes).
A little bit offtopic, but an interesting vim command is also:
vim# :set ff=unix (for changing eol from dos/mac to unix)
UPDATE: If you have many files to convert, or don't know how to use vim... :) you can use GNU iconv program.
No comments:
Post a Comment