Default Encoding Issues
I am having some problems with my default encodings within RubyMine.
Background:
I'm running a sinatra application using thin. I am running it within RubyMine.
I'm using version 3.2.4 build #RM-107.612, and I'm running is on OSX-Lion
Problem:
When I run my application using thin via RubyMine I get the following error:
invalid byte sequence in US-ASCII
When I run the application by starting the thin server on the command line, I do not get this errorm everything works correctly. As I start the thin server I inserted a puts statement:
puts Encoding.default_external
When I start up thin in Ruby Mine the output is:
US-ASCII
When I start up thin on the Command Line the output is:
UTF-8
The difference is that the Command line is using the system defaults as shown below.
>> locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
Where is RubyMine getting these encoding values from?, and how do you configure Ruby Mine to use the system defaults? Based on my research, I can change it in Ruby Mine -> Preferences -> File Encodings ... however, that menu doesn't exist, and I can't find anything comprable.
thanks.
mylo
请先登录再写评论。
See Preferences | General | IDE Encoding.
I opened Preferences -> General -> IDE Encoding
I tried setting it to UTF-8 and to System Default. No matter what it is set to, puts Encoding.default_external still returns US-ASCII
This problem is caused by the way OS X handles environment variables, please see http://devnet.jetbrains.net/docs/DOC-1160 for workaround
Dennis,
Thanks, that got it working.
I used that link to set:
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
After that Ruby Mine started up with all of the correct encodings.