| Line 81... |
Line 81... |
| 81 |
with other systems.) All three have \code{iconvlist}, ignore case in
|
81 |
with other systems.) All three have \code{iconvlist}, ignore case in
|
| 82 |
encoding names and support \samp{//TRANSLIT} (but with different
|
82 |
encoding names and support \samp{//TRANSLIT} (but with different
|
| 83 |
results, and for \samp{win_iconv} currently a \sQuote{best fit}
|
83 |
results, and for \samp{win_iconv} currently a \sQuote{best fit}
|
| 84 |
strategy is used except for \code{to = "ASCII"}).
|
84 |
strategy is used except for \code{to = "ASCII"}).
|
| 85 |
|
85 |
|
| 86 |
Most commercial Unixes contain an implemetation of \code{iconv} but
|
86 |
Most commercial Unixes contain an implementation of \code{iconv} but
|
| 87 |
none we have encountered have supported the encoding names we need:
|
87 |
none we have encountered have supported the encoding names we need:
|
| 88 |
the \dQuote{R Installation and Administration Manual} recommends
|
88 |
the \dQuote{R Installation and Administration Manual} recommends
|
| 89 |
installing GNU \samp{libiconv} on Solaris and AIX, for example.
|
89 |
installing GNU \samp{libiconv} on Solaris and AIX, for example.
|
| 90 |
|
90 |
|
| 91 |
There are other implementations, e.g.\sspace{} NetBSD has used one from the
|
91 |
There are other implementations, e.g.\sspace{} NetBSD has used one from the
|
| Line 94... |
Line 94... |
| 94 |
not been reported whether or not these work with \R.
|
94 |
not been reported whether or not these work with \R.
|
| 95 |
|
95 |
|
| 96 |
Note that you cannot rely on invalid inputs being detected, especially
|
96 |
Note that you cannot rely on invalid inputs being detected, especially
|
| 97 |
for \code{to = "ASCII"} where some implementations allow 8-bit
|
97 |
for \code{to = "ASCII"} where some implementations allow 8-bit
|
| 98 |
characters and pass them through unchanged or with transliteration.
|
98 |
characters and pass them through unchanged or with transliteration.
|
| 99 |
|
99 |
|
| 100 |
Some of the implementations have interesting extra encodings: for
|
100 |
Some of the implementations have interesting extra encodings: for
|
| 101 |
example GNU \samp{libiconv} allows \code{to = "C99"} to use
|
101 |
example GNU \samp{libiconv} allows \code{to = "C99"} to use
|
| 102 |
\samp{\\uxxxx} escapes for non-ASCII characters.
|
102 |
\samp{\\uxxxx} escapes for non-ASCII characters.
|
| 103 |
}
|
103 |
}
|
| 104 |
|
104 |
|
| Line 120... |
Line 120... |
| 120 |
as one of \code{"UCS-2"}, \code{"UTF-16"} and
|
120 |
as one of \code{"UCS-2"}, \code{"UTF-16"} and
|
| 121 |
\code{"UTF-32"}. Implementations differ in how they treat BOMs in
|
121 |
\code{"UTF-32"}. Implementations differ in how they treat BOMs in
|
| 122 |
\code{x} in other \code{from} encodings: they may be discarded,
|
122 |
\code{x} in other \code{from} encodings: they may be discarded,
|
| 123 |
returned as character \code{U+FEFF} or regarded as invalid.
|
123 |
returned as character \code{U+FEFF} or regarded as invalid.
|
| 124 |
}
|
124 |
}
|
| 125 |
|
125 |
|
| 126 |
\value{
|
126 |
\value{
|
| 127 |
If \code{toRaw = FALSE} (the default), the value is a character vector
|
127 |
If \code{toRaw = FALSE} (the default), the value is a character vector
|
| 128 |
of the same length and the same attributes as \code{x} (after
|
128 |
of the same length and the same attributes as \code{x} (after
|
| 129 |
conversion to a character vector).
|
129 |
conversion to a character vector).
|
| 130 |
|
130 |
|
| Line 142... |
Line 142... |
| 142 |
}
|
142 |
}
|
| 143 |
\note{
|
143 |
\note{
|
| 144 |
The only reasonably portable name for the ISO 8859-15 encoding,
|
144 |
The only reasonably portable name for the ISO 8859-15 encoding,
|
| 145 |
commonly known as \sQuote{Latin 9}, is \code{"latin-9"}: some
|
145 |
commonly known as \sQuote{Latin 9}, is \code{"latin-9"}: some
|
| 146 |
platforms support \code{"latin9"} but GNU \samp{libiconv} does not.
|
146 |
platforms support \code{"latin9"} but GNU \samp{libiconv} does not.
|
| 147 |
|
147 |
|
| 148 |
Encoding names \code{"utf8"}, \code{"mac"} and \code{"macroman"} are
|
148 |
Encoding names \code{"utf8"}, \code{"mac"} and \code{"macroman"} are
|
| 149 |
not portable. \code{"utf8"} is converted to \code{"UTF-8"} for
|
149 |
not portable. \code{"utf8"} is converted to \code{"UTF-8"} for
|
| 150 |
\code{from} and \code{to} by \code{iconv}, but not
|
150 |
\code{from} and \code{to} by \code{iconv}, but not
|
| 151 |
for e.g.\sspace{}\code{fileEncoding} arguments. \code{"macintosh"} is
|
151 |
for e.g.\sspace{}\code{fileEncoding} arguments. \code{"macintosh"} is
|
| 152 |
the official (and most widely supported) name for \sQuote{Mac Roman}
|
152 |
the official (and most widely supported) name for \sQuote{Mac Roman}
|