Read a file in a different encoding and return it as UTF-8 using iconv
readAndConvert(filename, encoding = "")
Character variable with path a file with text in encoding
Optional character variable with the encoding, if unset via the default empty string value no conversion is attempted.
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://fishandwhistle.net/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.
A character variable with converted file content.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.