R Studio Encoding

Viewed 79

Does anyone know how I can change the encoding in R so UFT8 is TRUE?

> l10n_info()
$MBCS
[1] FALSE

$`UTF-8`
[1] FALSE

$`Latin-1`
[1] TRUE

$codepage
[1] 1252

$system.codepage
[1] 1252
1 Answers

If you are using Windows, you can't. Windows doesn't support UTF-8 locales. Almost all other operating systems use UTF-8 by default these days, so the way to change that is to stop using Windows.

Windows was very early in adopting Unicode, and they went for an obsolete 16 bit encoding UCS-2. Later they changed to the very similar UTF-16, which is still a 16 bit encoding (but allows some characters to be represented by pairs of 16 bit values, so it covers all Unicode characters). Most other operating systems adopted Unicode later using the UTF-8 encoding, which is better in many respects than UTF-16, though occasionally it takes up more space: characters are based on 8 bit bytes, and some need 3 or 4 bytes, whereas very few UTF-16 characters need more than one 16 bit piece (2 bytes).

Related