Click
  1. Click
  2. CLK-56

Encoding problem of click and click-examples.war

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core, examples
    • Labels:
      None
    • Environment:
      Click 0.17

      Description

      Click has localized messages, but click-examples doesn't support charset encoding.
      So multi-byte characters messages are not displayed well, and also we can't input
      multi-byte characters.

      I think click-example should use UTF-8 encoding. And DateField (jsCalendar),
      Context has similar problem.

      • Page#getContentType() should return "text/html; charset=UTF-8".
        Or this return value should be configured by configuration files.
      • WEB-INF/velocity.properties should have following entries:
        input.encoding=UTF-8
        output.encoding=UTF-8
      • Should provide some methods to set request charset encoding as UTF-8.
        For examples, we can use SetCharsetEncodingFilter which is included in Tomcat.
      • calendar-xx.js should become UTF-8. Now, some js files are not UTF-8.
      • DateField#getHtmlImports() should return
        ...
        <script type="text/javascript" src=" {0}

        /click/calendar/calendar-

        {2}

        .js" charset="UTF-8"></script>

      • In the multipart request, Form#getRequestParameter() uses FileItem#getString().
        However this method uses the platform default charset encoding.
        Click should use FileItem#getString(request.getCharacterEncoding()).

      Anyway, this is all input and output encoding should be UTF-8.

      Especially, I think you should fix Form#getRequestParameter() because Click can't
      handle multi-byte chars in the multi-part form now. The priority of other problems might be low,
      we can solve them by configurations or other ways.

      Regards.

        Activity

        Hide
        Naoki Takezoe added a comment -

        Fixed only Context#getRequestParameter().
        Sorry, it wasn't Form#getRequestParameter().

        Show
        Naoki Takezoe added a comment - Fixed only Context#getRequestParameter(). Sorry, it wasn't Form#getRequestParameter().
        Hide
        Naoki Takezoe added a comment -

        Fixed DateField.

        • Localized JavaScripts are convetred to UTF-8.
        • DateField#getHtmlImports() returns <script type="text/javascript" src=" {0}

          /click/calendar/calendar-

          {2}

          .js" charset="UTF-8"></script>.

        Show
        Naoki Takezoe added a comment - Fixed DateField. Localized JavaScripts are convetred to UTF-8. DateField#getHtmlImports() returns <script type="text/javascript" src=" {0} /click/calendar/calendar- {2} .js" charset="UTF-8"></script>.
        Hide
        Naoki Takezoe added a comment -

        Added the way to specify character encoding in web.xml.
        For example:

        <servlet>
        <servlet-name>click-servlet</servlet-name>
        <servlet-class>net.sf.click.ClickServlet</servlet-class>
        <init-param>
        <param-name>charset</param-name>
        <param-value>UTF-8</param-value>
        </init-param>
        </servlet>

        Show
        Naoki Takezoe added a comment - Added the way to specify character encoding in web.xml. For example: <servlet> <servlet-name>click-servlet</servlet-name> <servlet-class>net.sf.click.ClickServlet</servlet-class> <init-param> <param-name>charset</param-name> <param-value>UTF-8</param-value> </init-param> </servlet>
        Hide
        Naoki Takezoe added a comment -

        The charset parameter was moved to the click.xml.

        <click charset="UTF-8">
        ...
        </click>

        Show
        Naoki Takezoe added a comment - The charset parameter was moved to the click.xml. <click charset="UTF-8"> ... </click>

          People

          • Assignee:
            Naoki Takezoe
            Reporter:
            Naoki Takezoe
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development