Default java encoding

Re: Default java encoding

by Richard Lobb -
Number of replies: 2

I'm not sure I understand the full context here. But it looks like the Jobe server on which this job was run hasn't had the locale set properly as per the install instructions here. Certainly the example code you've given works fine when I run it on my development system (and I expect on all other systems we run, too).

In reply to Richard Lobb

Re: Default java encoding

by Tim Hunt -

Strangely, when we run

echo $LANG

from the shell on the Jobe server, it says en_GB.UTF-.

However, if I go to a Java CodeRunner question, and run the code

int sumSquares(int[] data) {
System.out.println(String.format("LANG environment variable: %s", System.getenv("LANG")));
System.out.println(String.format("file.encoding: %s", System.getProperty("file.encoding")));
System.out.println(String.format("defaultCharset: %s", java.nio.charset.Charset.defaultCharset().name()));
return 0;
}

That gives

LANG environment variable: C
file.encoding: ANSI_X3.4-1968
defaultCharset: US-ASCII

We are continuing to investigate, but in the mean time, if you have any more clues, that would be appreciated.

In reply to Tim Hunt

Re: Default java encoding

by Richard Lobb -

I think the problem is that the job execution is initiated by Apache. The Jobe install instructions show how to set the Apache envvars (environment variables) to change from the default C/ASCII environment to something that's UTF-8 aware. It's those environment variable settings that are controlling the jobe task execution, not the OS/Shell environment.