localeToCharset
Select a Suitable Encoding Name from a Locale Name
Description
Returns a suitable encoding name from a locale name.
Usage
localeToCharset(locale = Sys.getlocale("LC_CTYPE"))
Arguments
locale |
a character string specifying the locale name. The default is the
current locale of LC_CTYPE.
|
Details
Use this function to get the suitable encoding name from a known
locale name. For example, "UTF-8", "ISO8859-1", "GB2312", "EUC-JP" and
"CP1255" are valid encoding names.
In Spotfire Enterprise Runtime for R, this function currently returns the single encoding
"UTF-8" for all locales except for the locale "C", where it
returns "ASCII".
Value
returns a character vector representing the known encoding names, or NA for
unknown names.
Differences between Spotfire Enterprise Runtime for R and Open-source R
- In Spotfire Enterprise Runtime for R, this function currently returns the single encoding
"UTF-8" for all locales except for the locale "C", where it
returns "ASCII".
- In open-source R, this function returns one or more encodings that are suitable
for the locale.
See Also
Examples
Sys.setlocale(loc = "")
localeToCharset()
Sys.setlocale(cat = "LC_TIME", loc = "chinese")
localeToCharset(loc = Sys.getlocale(cat="LC_TIME"))