Skip to content
Prev 14766 / 15075 Next

Bug in reading UTF-16LE file?

On 9/9/24 12:53, Tomas Kalibera wrote:
This is a problem in macOS libiconv. When converting from "UTF-16" with 
a BOM, it correctly learns the byte-order from the BOM, but later 
forgets it in some cases.? This is not a problem in R, but could be 
worked-around in R.

As Simon wrote, to avoid running into these problems (in released 
versions of R), one should use "UTF-16LE", so explicitly specify the 
byte-order in the encoding name. This is useful also because it is not 
clear what should be the default when no BOM is present and different 
systems have different defaults.

Best
Tomas