readAndConvert {dang} | R Documentation |
readAndConvert
Description
Read a file in a different encoding and return it as UTF-8 using iconv
Usage
readAndConvert(filename, encoding = "")
Arguments
filename |
Character variable with path a file with text in encoding |
encoding |
Optional character variable with the encoding, if unset via the default empty string value no conversion is attempted. |
Details
The function is an adapted version of the one in the Rcpp Gallery post at https://gallery.rcpp.org/articles/iconv-via-r-header/ which is itself based on https://dewey.dunnington.ca/post/2021/using-rs-cross-platform-iconv-wrapper-from-cpp11/. It is however worth pointing out that ‘iconv’ results have been seen to vary across operating systems. While it is portable it does not guarantee identical outcomes across implementations: results on Windows have different from those on Unix OSs.
Value
A character variable with converted file content.