Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: djm-restoreCon…
Fetching contributors…

Cannot retrieve contributors at this time

file 27 lines (23 sloc) 0.863 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
## from iconv.Rd
(x <- "fa\xE7ile")
charToRaw(xx <- iconv(x, "latin1", "UTF-8"))

iconv(x, "latin1", "ASCII") # NA
iconv(x, "latin1", "ASCII", "?") # "fa?ile"
iconv(x, "latin1", "ASCII", "") # "faile"
iconv(x, "latin1", "ASCII", "byte") # "fa<e7>ile"

# Extracts from R help files
(x <- c("Ekstr\xf8m", "J\xf6reskog", "bi\xdfchen Z\xfcrcher"))
iconv(x, "latin1", "ASCII//TRANSLIT")
iconv(x, "latin1", "ASCII", sub="byte")

## tests of re-encoding in .C
require("tools")
x <- "fa\xE7ile"
.C("Renctest", x, PACKAGE="tools")[[1]]
.C("Renctest", x, PACKAGE="tools", ENCODING="latin1")[[1]]
xx <- iconv(x, "latin1", "UTF-8")
.C("Renctest", xx, PACKAGE="tools", ENCODING="UTF-8")[[1]]

## tests of match length in delimMatch
x <- c("a{bc}d", "{a\xE7b}")
delimMatch(x)
xx <- iconv(x, "latin1", "UTF-8")
delimMatch(xx) ## 5 6 in latin1, 5 5 in UTF-8
Something went wrong with that request. Please try again.