UTF-8

Two applications that I have recently started to use, lilypond and R, required, or worked better with utf-8 encoded sources, so I took a deep breath and went unicode after having used iso-8859-1 for almost all my computing life.

Here is a list of things I had to change to get it all working:

substitute rxvt with rxvt-unicode-lite.

substitute \usepackage[latin1]{inputenc} with \usepackage[utf8]{inputenc} in my common_latex_packages.tex.

add LC_ALL=sv_SE.utf8 early in .xsession.

recode all my latex files using

find -iname "*.tex" -exec recode lat1..utf8 "{}" \;

recode some config files, like the alias-files of mutt, and some perl scripts

find .mutt -exec recode lat1..utf8 "{}" \;
recode lat1..utf8 worklog.config
recode lat1..utf8 mahjong

abandon a2ps in favor of muttprint

# apt-get --purge remove a2ps
# apt-get install muttprint
--------- .muttrc ---------
# set print_command="a2ps -1 -o mail.ps -g -Email --strip=1"
set print_command="muttprint"
-------- .muttrc ----------

And, in case of printing plain text files, use paps instead.

importing SPSS-files with R under UTF-8

Recent versions of read.spss() seems to do the right thing when run under UTF-8:

foo <- read.spss("foo.sav", reencode = "latin1", to.data.frame = TRUE)

Earlier, I had to use the following:

Credit to Peter Dalgaard for this thips!

library(foreign)
lc <- Sys.setlocale("LC_CTYPE")
Sys.setlocale("LC_CTYPE", "sv_SE")
foo <- read.spss("foo.sav", reencode = "latin1", to.data.frame = TRUE)
names(foo) <- iconv(names(foo), from = "latin1", to = "utf-8")
Sys.setlocale("LC_CTYPE", lc)

comments powered by Disqus


Back to the index

Blog roll

R-bloggers, Debian Weekly
Valid XHTML 1.0 Strict [Valid RSS] Valid CSS! Emacs Muse Last modified: oktober 17, 2019