readAndConvert: readAndConvert

Description Usage Arguments Details Value

View source: R/readAndConvert.R

Description

Read a file in a different encoding and return it as UTF-8 using iconv

Usage

1
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://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.

Value

A character variable with converted file content.


dang documentation built on Oct. 30, 2021, 1:08 a.m.