Hello, I am using R and Libreoffice on Ubuntu 11.10 (64-bit) and have been experiencing similar problems with character encoding (Swedish utf8) in odfWeave. Here is an example of what it looks like:
Should be: "Hör Ärland dåligt?" Appears as: "Hör Ãrland dÃ¥ligt?" I found a (pretty clumsy) solution which I post below. Has anyone been able to solve this in a more elegant way? Setup: > sessionInfo() R version 2.13.1 (2011-07-08) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=sv_SE.UTF-8 LC_NUMERIC=C other attached packages: [1] odfWeave_0.7.17 XML_3.2-0 lattice_0.19-30 Problem: I have some R syntax for tables in the file "in.odt": <<vl5, echo=FALSE, results=xml>>= irre <- xtabs(~Species, data=iris) irre <- data.frame(irre) colnames(irre) <- c("växt", "antal") row.names(irre) <- c("å", "ä", "ö") odfTable(irre) odfTableCaption("Tabell åäö") @ Running odfWeave on this with odfWeave("in.odt", "out.odt") yields lots of output, ending with this Warning message: ‘content.Rnw’ has unknown encoding: assuming Latin-1. On opening the output file (odt.out), Swedish characters appear jumbled. I had a look at the content.Rnw file, which was correctly coded with utf-8. The same was true for the content.xml file in the odt source (this had to be unzipped). I then tried downgrading to XML 3.2, as suggested elsewhere. This didn't help. I then looked for tools for converting an odt file from one kind of encoding to another, again to no avail. Solution: Save the odt file in flat xml format (Libreoffice > save as > second last option). Convert the resulting .fodt file FROM utf-8 TO latin 1 (aka ISO_8859-1) with iconv from a bash terminal: iconv -t ISO_8859-1 -f UTF-8 -o converted.fodt out.fodt This produces a correctly encoded file! -- View this message in context: http://r.789695.n4.nabble.com/odfWeave-UTF-8-error-and-latin-characters-tp2544333p4285335.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.