Martin Maechler
1997-May-12 13:25 UTC
R-alpha: ISO-latin-1 characters in strings -- print.default & PARSE(?) problems
There seems to be a problem in print.default with some ISO-latin1 characters (the chars AFTER ASCII in western Europe...) if they appear in strings. (no problem if they are part of a function comment, see below). Some of the characters lead to 4 character Hex-codes being printed instead: "û" ## ^u prints as "0xFB" If you use the funny characters in comments of functions, they are stored and printed properly. HOWEVER: In a few rare cases, the strings are not even PARSED properly; the line 'ISOdiv <- ..' below gives a SYNTAX error. The following code shows the symptoms : -- ONLY if the e-mail between here and your place is 8-bit clean! -- (else: get it ftp://ftp.stat.math.ethz.ch/U/maechler/R/string-test.R ) frenchquotes <- "«...»" ## <<...>> frenchquotes Umlaute <- "äöü ÄÖÜ" # = "a "o "u "A "O "U Umlaute #- only the last one is not printed properly... A.accents <- "àáâãäåæ ÀÁÂÃÄÅÆ" # `a 'a ^a "a oa ae `A 'A ^A "A oA AE A.accents EI.accents <- "ÈÉÊËÌÍÎÏ èéêëìíîï" EI.accents O.accents <- "ÒÓÔÕÖØòóôõöø" O.accents U.accents <- "ÙÚÛÜÝùúûüý" U.accents ISO24x <- "¡¢£¤¥¦§ ¨©ª«¬®¯" #octal 241..257 ISO26x <- "°±²³´µ¶· ¸¹º»¼½¾¿" #octal 260..277 ##--- THIS IS a Problem: It gives a SYNTAX error ! ISOdiv <- "×÷ Ðð Ññ Þþ ßÿ" ##-- One of these characters even was producing the same as 'q()' !! aa_ function(x) { x^2 ##- frenchquotes <- "«...»" ## <<...>> ##- Umlaute <- "äöü ÄÖÜ" # = "a "o "u "A "O "U ##- A.accents <- "àáâãäåæ ÀÁÂÃÄÅÆ" # `a 'a ^a "a oa ae `A 'A ^A "A oA AE ##- EI.accents <- "ÈÉÊËÌÍÎÏ èéêëìíîï" ##- O.accents <- "ÒÓÔÕÖØòóôõöø" ##- U.accents <- "ÙÚÛÜÝùúûüý" ##- ##- ISO24x <- "¡¢£¤¥¦§ ¨©ª«¬®¯" #octal 241..257 ##- ISO26x <- "°±²³´µ¶· ¸¹º»¼½¾¿" #octal 260..277 ##- ISOdiv <- "×÷ Ðð" ##-- OMITTED further: SYNTAX error !! } aa =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-