Uploaded image for project: 'Velocity Tools'
  1. Velocity Tools
  2. VELTOOLS-119

use "input.encoding" since 1.4



    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4, 2.0, 2.x
    • 3.0
    • VelocityView
    • None



      I have a request to VelocityViewServlet.

      Until Velocity Tools 1.3 , VelocityViewServlet used "input.encoding" velocity property at read templete file.

      Because tools 1.3 used following logic to create template.

      protected Template handleRequest(HttpServletRequest request,

      String path = ServletUtils.getPath(request);
      return getTemplate(path);
      public Template getTemplate(String name)

      return velocity.getTemplate(name);

      RuntimeInstance#getTemplate(String) method is asa follows, so used "input.encoding" property at read templete file.

      return getTemplate(name, getString( INPUT_ENCODING, ENCODING_DEFAULT));

      Since 1.4 , this logic changed and specify encoding in VelocityViewServlet(or VelocityView) with getTemplate(String name,String encoding) method.
      The used encoding is "response.getCharacterEncoding()".

      So "input.encoding" property is ignored sinse 1.4 (except response==null).

      This is very embarrassed for me.

      I have a web application used Velocity & VelocityTools that created at 2004 in Japan.

      That application used "Windows-31J" encoding because it was most popular japanese encoding (Japanese Windows Default Encoding).

      But , today used a lot of unicode characters except Windows-31J and I need to use these charactor in this application.

      This application's db is use unicode at first, Windows-31J used view part only.
      And these unicode character used input text only , not use in form phrase.

      I try to change response encoding to UTF-8 and velocity property defines as follows.( at 2007, used VelocityTools1.3)


      This try was sucess, and this application supported all unicode charactors without change all template files.

      I think this is collect use because Velocity have "input.encoding" and "output.encoding" property . Velocity allowed the case of templete encoding and output file encodig is differ.

      I want to use VelocityToool 2.0 , but can't use by this reason. ( It is difficult to convert all template files to UTF-8)

      Could you add the method of using "input.encoding" in VelocityViewServlet?




            brenmcguire Antonio Petrelli
            ikezawa Masakazu Ikezawa
            0 Vote for this issue
            0 Start watching this issue