| Line 81... |
Line 81... |
| 81 |
otherwise marked as UTF-8 of any of the inputs is marked as UTF-8.
|
81 |
otherwise marked as UTF-8 of any of the inputs is marked as UTF-8.
|
| 82 |
|
82 |
|
| 83 |
\code{\link{match}}, \code{\link{pmatch}}, \code{\link{charmatch}},
|
83 |
\code{\link{match}}, \code{\link{pmatch}}, \code{\link{charmatch}},
|
| 84 |
\code{\link{duplicated}} and \code{\link{unique}} all match in UTF-8
|
84 |
\code{\link{duplicated}} and \code{\link{unique}} all match in UTF-8
|
| 85 |
if any of the elements are marked as UTF-8.
|
85 |
if any of the elements are marked as UTF-8.
|
| 86 |
|
86 |
|
| 87 |
There is some ambiguity as to what is meant by a \sQuote{Latin-1}
|
87 |
There is some ambiguity as to what is meant by a \sQuote{Latin-1}
|
| 88 |
locale, since some OSes (notably Windows) make use of character
|
88 |
locale, since some OSes (notably Windows) make use of character
|
| 89 |
positions undefined (or used for control characters) in the ISO 8859-1
|
89 |
positions undefined (or used for control characters) in the ISO 8859-1
|
| 90 |
character set. How such characters are interpreted is
|
90 |
character set. How such characters are interpreted is
|
| 91 |
system-dependent but as from \R 3.5.0 they are if possible interpreted
|
91 |
system-dependent but as from \R 3.5.0 they are if possible interpreted
|
| Line 98... |
Line 98... |
| 98 |
For \code{enc2utf8} encodings are always marked: they are for
|
98 |
For \code{enc2utf8} encodings are always marked: they are for
|
| 99 |
\code{enc2native} in UTF-8 and Latin-1 locales.
|
99 |
\code{enc2native} in UTF-8 and Latin-1 locales.
|
| 100 |
}
|
100 |
}
|
| 101 |
\examples{
|
101 |
\examples{
|
| 102 |
## x is intended to be in latin1
|
102 |
## x is intended to be in latin1
|
| 103 |
x <- "fa\xE7ile"
|
103 |
x. <- x <- "fa\xE7ile"
|
| 104 |
Encoding(x)
|
104 |
Encoding(x.) # "unknown" (Linux) | "latin-1" (Win 32 server) | ....
|
| 105 |
Encoding(x) <- "latin1"
|
105 |
Encoding(x) <- "latin1"
|
| 106 |
x
|
106 |
x
|
| 107 |
xx <- iconv(x, "latin1", "UTF-8")
|
107 |
xx <- iconv(x, "latin1", "UTF-8")
|
| 108 |
Encoding(c(x, xx))
|
108 |
Encoding(c(x., x, xx))
|
| 109 |
c(x, xx)
|
109 |
c(x, xx)
|
| 110 |
Encoding(xx) <- "bytes"
|
110 |
xb <- xx; Encoding(xb) <- "bytes"
|
| 111 |
xx # will be encoded in hex
|
111 |
xb # will be encoded in hex
|
| 112 |
cat("xx = ", xx, "\n", sep = "")
|
112 |
cat("x = ", x, ", xx = ", xx, ", xb = ", xb, "\n", sep = "")
|
| - |
|
113 |
(Ex <- Encoding(c(x.,x,xx,xb)))
|
| - |
|
114 |
stopifnot(identical(Ex, c(Encoding(x.), Encoding(x),
|
| - |
|
115 |
Encoding(xx), Encoding(xb))))
|
| 113 |
}
|
116 |
}
|
| 114 |
\keyword{utilities}
|
117 |
\keyword{utilities}
|
| 115 |
\keyword{character}
|
118 |
\keyword{character}
|