Grails
  1. Grails
  2. GRAILS-5748

UTF-8 should be configured as a default in JAVA_OPTS in grails starting script for Mac OS X

    Details

    • Type: Wish Wish
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2 final
    • Fix Version/s: None
    • Component/s: Commons, View technologies
    • Labels:
      None
    • Environment:
      Mac OS X

      Description

      Hi guys

      Grails default configuration in Config.groovy is to use UTF-8 for GSP.
      When you put a simple HTML page in your web-apps project, that defines UTF-8, is encoded as UTF-8, well it does not work with Grails on Mac OS X. Grails uses the default platform encoding (Mac Roman). The solution is easy : we need to specify the file encoding as a JVM parameter when the application starts.

      To solve the issue, one has to manually force the following JAVA_OPTS so that Grails handles correctly those files
      set JAVA_OPTS='-Dfile.encoding=UTF-8'

      Then when you launch Grails, it works like a charm.

      However here is my request:
      Can you add "-Dfile.encoding=UTF-8" in the startGrails SHELL script ? and also in the Windows bat script please ?

      Thanks !

      Nicolas

      --------------------

      (from startGrails sh script)
      startGrails() {
      CLASS=$1
      shift
      JAVA_OPTS="-server -Xmx512M -XX:MaxPermSize=96m -Dfile.encoding=UTF-8 $JAVA_OPTS"
      ...
      ...

        Activity

        Nicolas Martignole created issue -
        Graeme Rocher made changes -
        Field Original Value New Value
        Fix Version/s 1.2.1 [ 16060 ]
        Graeme Rocher made changes -
        Fix Version/s 1.2.2 [ 16198 ]
        Fix Version/s 1.2.1 [ 16060 ]
        Burt Beckwith made changes -
        Remaining Estimate 2 hours [ 7200 ]
        Original Estimate 2 hours [ 7200 ]
        Graeme Rocher made changes -
        Fix Version/s 1.2.2 [ 16198 ]
        Fix Version/s 1.2.3 [ 16313 ]
        Graeme Rocher made changes -
        Assignee Graeme Rocher [ graemerocher ]
        Jeff Scott Brown made changes -
        Fix Version/s 1.2.3 [ 16313 ]
        Fix Version/s 1.2.4 [ 16555 ]
        Jeff Scott Brown made changes -
        Fix Version/s 1.2.5 [ 16652 ]
        Fix Version/s 1.2.4 [ 16555 ]
        Jeff Scott Brown made changes -
        Fix Version/s 1.3.6 [ 16730 ]
        Fix Version/s 1.2.5 [ 16652 ]
        Jeff Scott Brown made changes -
        Fix Version/s 1.3.6 [ 16730 ]
        Fix Version/s 1.4-M1 [ 16812 ]
        Contegix Support made changes -
        Project Import Thu Mar 24 21:22:24 CDT 2011 [ 1301019744151 ]
        Graeme Rocher made changes -
        Fix Version/s 1.4-M2 [ 12504 ]
        Fix Version/s 1.4-M1 [ 11040 ]
        Graeme Rocher made changes -
        Fix Version/s 2.0-M2 [ 12805 ]
        Fix Version/s 2.0-M1 [ 12504 ]
        Burt Beckwith made changes -
        Workflow jira [ 34899 ] Grails [ 41110 ]
        Burt Beckwith made changes -
        Workflow Grails [ 41110 ] Copy of Grails [ 48539 ]
        Burt Beckwith made changes -
        Workflow Copy of Grails [ 48539 ] Grails [ 55949 ]
        Burt Beckwith made changes -
        Workflow Grails [ 55949 ] Grails2 [ 63494 ]
        Hide
        Marco Trevisan added a comment - - edited

        I had a similar problem and just found it was my fault, since I used a PrintWriter in the wrong way.

        In my humble opinion the solution should not be to change "file.encoding", instead Grails should not depend on the platform encoding in its internal processing.

        A grails webapp shold be able to work in a servlet container among other webapps -some of which may require different settings of "file.encoding".

        Show
        Marco Trevisan added a comment - - edited I had a similar problem and just found it was my fault, since I used a PrintWriter in the wrong way. In my humble opinion the solution should not be to change "file.encoding", instead Grails should not depend on the platform encoding in its internal processing. A grails webapp shold be able to work in a servlet container among other webapps -some of which may require different settings of "file.encoding".
        Graeme Rocher made changes -
        Fix Version/s 2.0-M2 [ 12805 ]
        Fix Version/s 2.0-RC1 [ 12803 ]
        Hide
        Richard Zhang added a comment -

        I have this problem too. when I deploy my app to tomcat as a war, all double-byte chars in simple html page will be displayed as a blackdiamond. Change file.encoding to UTF-8 solve this problem.

        Show
        Richard Zhang added a comment - I have this problem too. when I deploy my app to tomcat as a war, all double-byte chars in simple html page will be displayed as a blackdiamond. Change file.encoding to UTF-8 solve this problem.
        Graeme Rocher made changes -
        Fix Version/s 2.0.1 [ 13005 ]
        Fix Version/s 2.0-RC1 [ 12803 ]
        Burt Beckwith made changes -
        Workflow Grails2 [ 63494 ] jira [ 71177 ]
        Burt Beckwith made changes -
        Workflow jira [ 71177 ] Grails2 [ 79220 ]
        Peter Ledbrook made changes -
        Last Reviewed 01/Jan/10
        Peter Ledbrook made changes -
        Workflow Grails2 [ 79220 ] jira [ 87413 ]
        Peter Ledbrook made changes -
        Workflow jira [ 87413 ] Grails2 [ 95568 ]
        Graeme Rocher made changes -
        Fix Version/s 2.0.2 [ 13064 ]
        Fix Version/s 2.0.1 [ 13005 ]
        Graeme Rocher made changes -
        Fix Version/s 2.0.3 [ 13094 ]
        Fix Version/s 2.0.2 [ 13064 ]
        Graeme Rocher made changes -
        Fix Version/s 2.0.4 [ 13099 ]
        Fix Version/s 2.0.3 [ 13094 ]
        Jeff Scott Brown made changes -
        Fix Version/s 2.2 [ 13093 ]
        Fix Version/s 2.0.4 [ 13099 ]
        Graeme Rocher made changes -
        Fix Version/s 2.3 [ 13311 ]
        Fix Version/s 2.2-RC1 [ 13093 ]
        Graeme Rocher made changes -
        Fix Version/s 2.3-M2 [ 13457 ]
        Fix Version/s 2.3-M1 [ 13311 ]
        Graeme Rocher made changes -
        Fix Version/s 2.3-RC1 [ 13458 ]
        Fix Version/s 2.3-M2 [ 13457 ]
        Graeme Rocher made changes -
        Fix Version/s 2.3-RC2 [ 13482 ]
        Fix Version/s 2.3-RC1 [ 13458 ]
        Graeme Rocher made changes -
        Fix Version/s 2.3.1 [ 13502 ]
        Fix Version/s 2.3-RC2 [ 13482 ]
        Graeme Rocher made changes -
        Fix Version/s 2.3.1 [ 13502 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Nicolas Martignole
          • Votes:
            6 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development