Skip to content

Running odfWeave on its own examples.odt

7 messages · Duncan Murdoch, info, Frans Marcelissen +2 more

#
I'm trying to see if I can help some Windows users, but in WinXP and Win7 virtual machines
and in a Win 7-64 real environment, after extracting the odfWeave examples.odt from the
package and putting it in my working directory ("My Documents") where R can see and unpack
it, I get "unable to convert 'examples.odt' to the current locale". I've tried some
searches about UTF8 on Windows, which gave discouraging answers, and also the Sweave
manual suggestions of different options(), e.g., I tried the suggestions regarding
useFancyQuotes but without success.

Things work fine (of course!) in Linux of different flavours, so I suspect this is a
general Win issue, and I'm hopeful there is a simple workaround.

The reproducible code is to source("tester.R") from R prompt or else

Rscript tester.R

where tester.R contains

  library(odfWeave)
  test<-odfWeave("examples.odt", "ex1out.odt")

and this gives the same message "unable to convert examples.odt in the current locale".

For information, changing the file to "simple.odt" does work, at least on one of my systems.

John Nash
#
On 12-08-10 7:55 AM, John C Nash wrote:
I just tried that in WinXP 32 bit, and it ran without problem.  This was 
in R-patched, with odfWeave 0.8.1.

Which versions were you using?

Duncan Murdoch
#
My bad. Should have included sessionInfo(). Here it is for the two virtual machines -- 
rebooting is a pain!

Since Duncan found it "worked" for him, I suspect some configuration issue. I'm happy to 
off-list until it is resolved. I also see the locales, which are clearly NOT utf8, so 
maybe Cygwin let's me change them?

JN


WinXP: Professional, Version 2002, Service Pack 3
 > sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] MASS_7.3-18    odfWeave_0.8.1 XML_3.9-4.1    lattice_0.20-6

loaded via a namespace (and not attached):
[1] tools_2.15.1
 >

Win7: (Professional, Service Pack 1)
 > sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] odfWeave_0.8.1 XML_3.9-4.1    lattice_0.20-6

loaded via a namespace (and not attached):
[1] grid_2.15.1
On 12-08-10 08:59 AM, Duncan Murdoch wrote:
#
I have the same problem on a linux webserver. It has to do with the locale.
Until now,I do'nt have a solution, but I have a (unsatisfactory) workaround.
This only happens when the text contains non-ascii characters like trema's (
?) or accents (?). Double quotes also gives problems, but single quotes
do'nt. 
Frans
-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
Namens Duncan Murdoch
Verzonden: vrijdag 10 augustus 2012 15:00
Aan: nashjc at uottawa.ca
CC: r-help at r-project.org
Onderwerp: Re: [R] Running odfWeave on its own examples.odt
On 12-08-10 7:55 AM, John C Nash wrote:
options(), e.g., I tried the suggestions regarding useFancyQuotes but
without success.
workaround.
current locale".
one of my systems.

I just tried that in WinXP 32 bit, and it ran without problem.  This was in
R-patched, with odfWeave 0.8.1.

Which versions were you using?

Duncan Murdoch
______________________________________________
R-help at 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.
#
Hi,
I had the same problem unde linux. My friend Albert Jan Roskam knew the
solution: add
  Sys.setlocale(category = "LC_ALL", locale = "en_US.UTF-8")
I suppose this also works under windows.
Frans

-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
Namens John C Nash
Verzonden: vrijdag 10 augustus 2012 15:16
Aan: Duncan Murdoch
CC: r-help at r-project.org
Onderwerp: Re: [R] Running odfWeave on its own examples.odt

My bad. Should have included sessionInfo(). Here it is for the two virtual
machines -- rebooting is a pain!

Since Duncan found it "worked" for him, I suspect some configuration issue.
I'm happy to off-list until it is resolved. I also see the locales, which
are clearly NOT utf8, so maybe Cygwin let's me change them?

JN


WinXP: Professional, Version 2002, Service Pack 3  > sessionInfo() R version
2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United
States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5]
LC_TIME=English_United States.1252

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] MASS_7.3-18    odfWeave_0.8.1 XML_3.9-4.1    lattice_0.20-6

loaded via a namespace (and not attached):
[1] tools_2.15.1
 >

Win7: (Professional, Service Pack 1)
 > sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United
States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5]
LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] odfWeave_0.8.1 XML_3.9-4.1    lattice_0.20-6

loaded via a namespace (and not attached):
[1] grid_2.15.1
On 12-08-10 08:59 AM, Duncan Murdoch wrote:
options(), e.g., I tried the suggestions regarding useFancyQuotes but
without success.
workaround.
current locale".
______________________________________________
R-help at 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.
#
WinXP says

OS reports request to set locale to "en_US.UTF-8" cannot be honored.

Sigh.

JN
On 08/10/2012 11:40 AM, Frans Marcelissen wrote:
9 days later
#
On 10/08/2012 16:53, John C Nash wrote:
Yes, Windows has no UTF-8 locales: they are all 8-bit or DBCS (which is 
ASCII plus 2-byte codes for CJK languages).   You can work in UTF-16 in 
any locale, but lots of things (including those written by Microsoft and 
R's internals) do not.  There is also some very-low-level support for 
UTF-8 (which is how iconv() works on Windows).

So nowadays there are just about 3 camps

(a) UTF-8 used by all the Unix-alikes, including Mac OS X
(b) Windows
(c) C/POSIX locale, used by people who have not set a locale at all 
(since C mandates it as the default) and those with no others installed. 
  (I may not be current, but this was the case for Cygwin a year or two 
ago.)

For quite a while odfWeave only worked in a UTF-8 locale, but recently 
it has also worked in CP1252 (which is what your info below shows) on 
Windows and Latin-1 on Linux.  Duncan Murdoch reported it worked for him 
in CP1252, winbuilder works, and I've just re-checked Latin-1 on Fedora 
16.   So whatever the root cause here was, I don't think it was the 
Windows locale.  It might be Cygwin interfering ... but probably Duncan 
used his usual Cygwin bash shell.