On 06/06/2019 6:22 a.m., Tomas Kalibera wrote:> On 6/5/19 3:49 AM, Steven Penny wrote: >> Using this in my "~/.profile": >> >> ?? export LC_ALL=en_US.UTF-8 >> >> Yields this: >> >> ?? $ Rscript -e 'print(9)' >> ?? During startup - Warning message: >> ?? Setting LC_CTYPE=en_US.UTF-8 failed >> ?? [1] 9 >> >> This is confusing as the exact same environment works fine with other >> languages: >> >> ?? $ python3 -c 'print(9)' >> ?? 9 >> >> ?? $ ruby -e 'puts 9' >> ?? 9 > > The locale is probably not available on your system, please > install/generate it.I think Steven is running the Windows build, not a POSIX build, so that's not a legal value. He could try the Cygwin build, but I think it has other problems, and isn't supported by R Core. As far as I know there is no Windows locale that fully supports UTF-8. Duncan Murdoch
On 06/06/2019 7:28 a.m., Duncan Murdoch wrote:> On 06/06/2019 6:22 a.m., Tomas Kalibera wrote: >> On 6/5/19 3:49 AM, Steven Penny wrote: >>> Using this in my "~/.profile": >>> >>> ?? export LC_ALL=en_US.UTF-8 >>> >>> Yields this: >>> >>> ?? $ Rscript -e 'print(9)' >>> ?? During startup - Warning message: >>> ?? Setting LC_CTYPE=en_US.UTF-8 failed >>> ?? [1] 9 >>> >>> This is confusing as the exact same environment works fine with other >>> languages: >>> >>> ?? $ python3 -c 'print(9)' >>> ?? 9 >>> >>> ?? $ ruby -e 'puts 9' >>> ?? 9 >> >> The locale is probably not available on your system, please >> install/generate it. > > I think Steven is running the Windows build, not a POSIX build, so > that's not a legal value. He could try the Cygwin build, but I think it > has other problems, and isn't supported by R Core. As far as I know > there is no Windows locale that fully supports UTF-8. >The Windows name for a UTF-8 locale is supposed to be en_US.65001 (see <https://docs.microsoft.com/en-us/cpp/c-runtime-library/locale-names-languages-and-country-region-strings?view=vs-2019> if it hasn't disappeared by the time you read this). However, when I tried that a few years ago, it didn't work. Maybe it does now. Duncan Murdoch
On 6/6/19 3:24 PM, Duncan Murdoch wrote:> On 06/06/2019 7:28 a.m., Duncan Murdoch wrote: >> On 06/06/2019 6:22 a.m., Tomas Kalibera wrote: >>> On 6/5/19 3:49 AM, Steven Penny wrote: >>>> Using this in my "~/.profile": >>>> >>>> ? ?? export LC_ALL=en_US.UTF-8 >>>> >>>> Yields this: >>>> >>>> ? ?? $ Rscript -e 'print(9)' >>>> ? ?? During startup - Warning message: >>>> ? ?? Setting LC_CTYPE=en_US.UTF-8 failed >>>> ? ?? [1] 9 >>>> >>>> This is confusing as the exact same environment works fine with other >>>> languages: >>>> >>>> ? ?? $ python3 -c 'print(9)' >>>> ? ?? 9 >>>> >>>> ? ?? $ ruby -e 'puts 9' >>>> ? ?? 9 >>> >>> The locale is probably not available on your system, please >>> install/generate it. >> >> I think Steven is running the Windows build, not a POSIX build, so >> that's not a legal value.? He could try the Cygwin build, but I think it >> has other problems, and isn't supported by R Core.? As far as I know >> there is no Windows locale that fully supports UTF-8. >> > > The Windows name for a UTF-8 locale is supposed to be en_US.65001 (see > <https://docs.microsoft.com/en-us/cpp/c-runtime-library/locale-names-languages-and-country-region-strings?view=vs-2019> > if it hasn't disappeared by the time you read this).? However, when I > tried that a few years ago, it didn't work.? Maybe it does now.Yes, it is 65001 but it still cannot be used as setlocale() Windows locale (in LC_CTYPE), and hence R on Windows cannot use UTF-8 as native encoding. Tomas> > Duncan Murdoch
Possibly Parallel Threads
- Setting LC_CTYPE=en_US.UTF-8 failed
- Setting LC_CTYPE=en_US.UTF-8 failed
- Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '<ff>' if an environment variable contains \xFF
- Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '<ff>' if an environment variable contains \xFF
- Bug in RScript.exe for 3.5.0