Changeset 33793 for main/trunk


Ignore:
Timestamp:
2019-12-11T18:28:29+13:00 (4 years ago)
Author:
ak19
Message:

Changes for getting a running GS3 server to display collections on Cher's Chinese locale machine. 1. A key change so far turned out to be the improvement Dr Bainbridge wanted in gs2build\setup.bat for this: which is controlling the codepage to be the English locale's Windows default of codepage 850 (but changed to 866 if GSDLLANG is Russian, so setup,bat's display strings in Russian print correctly. 2. Other changes were for XML parsing to parse utf8-file contents correctly on the Chinese locale, by seting JAVA_TOOL_OPTIONS env var to pass file.encoding=UTF-8 to the JVM (set in gs2build\setup.bat and exported in gs3-setup.bat), as well as for ant targets force-start-tomcat and force-stop-tomcat in build.xml to do the same. 3. Finally, uncomment Alias.pm import in perllib\plugins\DirectoryPlugin.pm and rename the new perllib\cpan\Encode's Alias.pm.newForLocaleIssue and updated Locale.pm.newForLocaleIssue to Alias.pm and Locale.pm respectively. Dr Bainbridge found that this was necessary for perl to work with the encoding on the Chinese locale, else running things like pluginfo.pl -describeAll on Windows would break on such locales.

Location:
main/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/setup.bat

    r32986 r33793  
    66CD /D "%~dp0"
    77set GSDLLANG=en
     8
     9:: This script's contents were created in Windows codepage 850 (Western European).
     10:: When this script is run in non-English locales like the Chinese locale, the
     11:: character content/encoding of this script can get wrongly interpreted by the
     12:: different encoding of the locale. And then the GS environment gets set wrongly
     13:: or incompletely in those cases.
     14:: So we force this script to be run and interpreted in codepage 850.
     15:: However, the Russian display strings in this script were desgined to work in the
     16:: default Russian Windows codepage 866. Whereas, codepage 850 works for this
     17:: script's remaining English, French, Spanish display strings. So:
     18if ("!GSDLLANG!" == "ru") (
     19    chcp 866
     20) else (
     21    chcp 850
     22)
    823
    924echo.
     
    282297:: https://www.gnu.org/software/wget/manual/html_node/Wgetrc-Location.html
    283298set WGETRC=%GSDLHOME%/bin/%GSDLOS%/wgetrc
     299
     300
     301:: On other localse, like Chinese locales, for XMLParsers to read (XML) files
     302:: in UTF-8 encoding (instead of defaulting to encoding GBK when on Chinese locale),
     303:: need to pass -Dfile.encoding=UTF-8 to the JVM. Can have this passed to the JVM by
     304:: setting the JAVA_TOOL_OPTIONS environment variable to this here.
     305:: For example, the example at https://www.mkyong.com/java/how-to-read-utf-8-xml-file-in-java-sax-parser/
     306:: doesn't work in a Chinese locale until the program is run with
     307:: java -Dfile.encoding=UTF-8 <ReadXMLUTF8FileSAX>
     308::
     309::set JAVA_TOOL_OPTIONS=%JAVA_TOOL_OPTIONS% -Dfile.encoding=UTF-8
     310rem set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
  • main/trunk/greenstone3/build.xml

    r33462 r33793  
    24792479    </exec>
    24802480    <exec executable="${catalina.home}/bin/startup.bat" osfamily="windows" dir="${catalina.home}/bin" spawn="true">
     2481      <!--<env key="JAVA_TOOL_OPTIONS" value="-Dfile.encoding=UTF-8"/>-->
    24812482      <env key="GSDLOS" value="windows"/>
    24822483      <env key="GSDL3HOME" value="${web.home}"/>
     
    25312532    </exec>
    25322533    <exec executable="${catalina.home}/bin/shutdown.bat" osfamily="windows" dir="${catalina.home}/bin" spawn="false">
     2534      <!--<env key="JAVA_TOOL_OPTIONS" value="-Dfile.encoding=UTF-8"/>-->
    25332535      <env key="FEDORA_HOME" path="${fedora.home}"/>
    25342536      <env key="CATALINA_HOME" value="${catalina.home}"/>
  • main/trunk/greenstone3/gs3-setup.bat

    r32987 r33793  
    351351set JAVA_HOME=%JAVA_HOME%& set JRE_HOME=%JRE_HOME%& set ANT_HOME=%ANT_HOME%& set CLASSPATH=%CLASSPATH%
    352352
     353rem For locales that are significantly different from the English locale, for example for
     354rem Chinese locales, UTF-8 XML files parsed by DOM or SAX XML parser in Java code requires
     355rem -Dfile.encoding=UTF-8 to be passed to the JVM. We can ensure this happens by setting
     356rem the JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 in gs2build\setup.bat and exporting it as below.
     357rem In that case, can also set this in force-start-tomcat and force-stop-tomcat in build.xml
     358rem Finally, in DirectoryPlugin.pm, uncomment Alias.pm and rename *forLocaleIssue files
     359rem in cpan\Encode to Alias.pm and the up-to-date Locale.pm.
     360rem endlocal & set RUNJAVA=%RUNJAVA%& set PATH=%PATH%& set GSDLOS=%GSDLOS%& set GSDLHOME=%GSDLHOME%& set GSDL3HOME=%GSDL3HOME%& set GSDL3SRCHOME=%GSDL3SRCHOME%& ^
     361set JAVA_HOME=%JAVA_HOME%& set JRE_HOME=%JRE_HOME%& set JAVA_TOOL_OPTIONS=%JAVA_TOOL_OPTIONS%& set ANT_HOME=%ANT_HOME%& set CLASSPATH=%CLASSPATH%
     362
    353363:end
Note: See TracChangeset for help on using the changeset viewer.