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... Thanks Halldor -- ------------------------------------------ Halldor Bjornsson (halldor at vedur.is) Vedurstofa Islands (Icelandic Met. Office) Bustadavegur 9, IS-150, Reykjavik, Iceland
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
On Mon, 25 Oct 2004, Halldor Bj??rnsson wrote:> 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's a bug in your version of Windows. print() tests for printable characters, by if(isprint((int)*p)) in src/utils/printutils.c, and that in turn asks Windows about your locale. (The Rgui console used to do this, but Windows crashed too often when it did.) Assuming your machine is set correctly to an Icelandic locale, the only solution I know of is to write your own replacement for isprint and compile that into a build of R. If you can, it might be worth trying another version of Windows: we saw something similar in Czech that worked in Windows XP but not 2000. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595