The R Project SVN R

Rev

Rev 81148 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 81148 Rev 89894
Line 9... Line 9...
9
sr <- 0xD800:0xDFFF
9
sr <- 0xD800:0xDFFF
10
stopifnot(is.na(y[sr]))
10
stopifnot(is.na(y[sr]))
11
stopifnot(!is.na(y[-sr]))
11
stopifnot(!is.na(y[-sr]))
12
## too large values: originally handled by UTF-8, but not in RFC3629
12
## too large values: originally handled by UTF-8, but not in RFC3629
13
## R >= 3.4.3 conforms to RFC3629
13
## R >= 3.4.3 conforms to RFC3629
-
 
14
naUtf8 <- function(...) is.na(intToUtf8(...))
14
stopifnot(is.na(intToUtf8(c(0x200000, 0x10FFFF + 1:10))))
15
stopifnot(naUtf8(c(0x200000, 0x10FFFF + 1:10)),
-
 
16
          naUtf8(-1L), naUtf8(-5:-1), naUtf8(-1:-4, multiple=TRUE))
15
 
17
 
16
## next command is quite slow.
18
## next command is quite slow.
17
xx <- sapply(y, function(x) tryCatch(utf8ToInt(x),
19
xx <- sapply(y, function(x) tryCatch(utf8ToInt(x),
18
                                     error = function(e) NA_character_))
20
                                     error = function(e) NA_character_))
19
invalid <- sr # previously included 0xFFFE and 0xFFFF
21
invalid <- sr # previously included 0xFFFE and 0xFFFF