For anyone that's interested on this, I will summarise here my 
conclusions on this problem

1.
In Windows, Java does not recognize the encoding of text files (e.g. 
JmolScript files) and loads them always in the system default 
encoding, Windows-1252. This is so for both Jmol application and Jmol 
applets. I guess that in other OSs the situation will be similar but 
with a different default (for instance, as far as I know MacOS used 
Unicode by default).

By looking at the Java console (from the browser after an applet has 
been loaded) I see this report:
Java console > press "s" (for dumping system properties) gives
    "file.encoding = Cp1252"
(Which I understand as the Windows-1252 encoding)


2.
How to force reading files as UTF-8?

2A.
In the application, this can be done by invoking Jmol as:
  javaw -Xmx512m -Dfile.encoding=UTF8 -jar Jmol.jar
(the -Xmx is optional and bears no relation with this problem; I just 
copied it from the standard jmol.bat)

or enter this into a command line:
  set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
and then call the Jmol app normally:
  javaw -Xmx512m -jar Jmol.jar

Possibly, if you add that "set" command into your system startup 
(autoexec.bat? or to system environment variables via the control 
panel), the setting will be default for any instance of the app.

2B.
In the applet, go to "Control Panel > Java > Java tab > Configure 
Runtime Environment" and add the runtime parameter
  -Dfile.encoding=UTF8
After that, the applets will read files as UTF8 


3.
All of the above does not apply to Javascript files, which are 
interpreted by the browser according to whatever encoding is declared 
in the meta tag of the calling html file.
So you can save a .JS text file as either UTF-8 (Unicode) or 
ISO8859-1 (Western European / ANSI / Roman / Latin) and it will work 
as long as the .html file is declared and saved in the same encoding.



------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to