Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting UTF-8 #46

Open
brianbolt opened this issue May 16, 2017 · 2 comments
Open

Setting UTF-8 #46

brianbolt opened this issue May 16, 2017 · 2 comments

Comments

@brianbolt
Copy link
Contributor

brianbolt commented May 16, 2017

Using Rapache (1.2.5) I am trying to read an excel file with a Δ character in it. I then write the content back out to csv but end up with "<U+0394>". I found that if I ran the line below before my code, then the csv would get the correct Δ character.

Sys.setlocale("LC_ALL", "en_US.utf8")

I came across this old post that I don't think answers the question:
http://stackoverflow.com/questions/20577764/set-locale-to-system-default-utf-8

I am wondering what the best way is to set UTF-8 instead of "C" on an rapache server (given I may use Ubuntu, Centos and other linux flavors).

Thanks,
Brian

@jeffreyhorner
Copy link
Owner

You could add that code using the REvalOnStartup or RSourceOnStartup directive. That way every time a new apache process is created it gets set.

http://rapache.net/manual.html

@brianbolt
Copy link
Contributor Author

brianbolt commented May 17, 2017

Thanks. The real issue is that the rapache locale was different than the default system locale. Rapache was started with an init.d script that didn't fetch the LANG environment variable.

Doing this in the init.d script for the few linux flavors we work with fixed the issue:

Ubuntu

[ -f /etc/default/locale ] && . /etc/default/locale

Centos

[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
export LANG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants