[R] printing ISO/8859-1 characters

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Oct 25 19:20:38 CEST 2004


Halldor Björnsson <halldor at vedur.is> writes:

> Hi,
> I ran into an odd problem with the print command for R-2.0 on a
> windows machine.
> 
> The icelandic character thorn (þ,Þ) which is included in in the Latin-1
> character set [iso/8859-1 char# 222 (upper case) and #254 (lower case)]
> prints out incorrectly. Instead of getting the correct
> character I get the octal codes for upper and lower case thorn (\336
> or \376). This only happens on a windows machine, but not on a linux
> box.
> 
> This is not some problem generic to the Latin-1 characters. I get
> all accented characters correctly and also the character eth (?Ð).
> Its only thorn thats problematic...
> 
> This problem also shows up on the commandline a <-"Þ" works
> ok, but print(a) or just:
> a
> returns the octal number.
> 
> However, when using THORN in plotlabels it works fine.
> 
> If anyone knows how to fix this I would be very happy to hear from them...

It happens if (and presumably only if) isprint('þ') is 0 in the
internal C code. We have heard about similar bugs in Microsoft DLLs
before. It is not a bug in R as such, but it might help to replace - I
think it is - msvcrt.dll.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list