Why do some Unicode characters display in matrices, but not data frames in R?

I hate to answer my own question, but although the comments and answers helped, they weren’t quite right. In Windows, it doesn’t seem like you can set a generic ‘UTF-8’ locale. You can, however, set country-specific locales, which will work in this case:

Sys.setlocale("LC_CTYPE", locale="Chinese")
q2 # Works fine
#  q
#1 天

But, it does make me wonder why exactly format seems to use the locale; I wonder if there is a way to have it ignore the locale in Windows. I also wonder if there is some generic UTF-8 locale that I don’t know about on Windows.

Leave a Comment