Character encoding issue

I’ve written some code for an emoji sentiment analysis using Twitter's API, but I’d like to use it to look up tweets by entering query keywords in languages that don’t use the latin alphabet. For Thai, for example, I’ve added this line of code:

Sys.setlocale(“LC_ALL”, “th_TH.UTF8”)

But when I run the code I get an error. I've just spotted this is a known issue (bottom of this page: Character Encoding in the RStudio IDE – RStudio Support)

Any advice?