1 Reply Latest reply on Jan 18, 2012 11:11 AM by Benjamin Browning

    Downloading a file with Multi Byte Character filename

    Morgan Daniel Newbie

      Hello,

       

      I am running Redmine 1.3.0 (Rails App) using TorqueBox 2.0.0.beta2 which contains JBoss AS7.

      I had an issue accessing URLs which contained multi byte characters but fixed it by adding the following in "standalone.xml":

       


      <property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>

      <property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/>

       

      However, I still have an issue when downloading an attachment in Redmine which contains multi byte characters in the filename.

      The file is streamed to the client without any problems, but the filename gets garbled when saving it onto disk from the browser.

       

      Server Setup:

      Windows Server 2008 R2 Standard

      Java 6 SE Update 30

      TorqueBox 2.0.0.beta2

      JBoss AS 7.1.0.CR1b

      JRuby 1.6.5.1

      Redmine 1.3.0

       

      Client Setup:

      WinXP SP3

      Firefox 9.0.1

       

      I did not have this issue with a Webrick + JRuby + Redmine setup.

      Am I missing any settings in JBoss?

       

      *** Update ***

      I captured the HTTP headers from Firefox.

       

      Headers using JBoss:

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

      GET /attachments/download/1/%E6%96%B0%E8%A6%8F.txt HTTP/1.1

      Host: localhost

      User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1

      Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

      Accept-Language: ja,en-us;q=0.7,en;q=0.3

      Accept-Encoding: gzip, deflate

      Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7

      Connection: keep-alive

      Referer: http://localhost/attachments/1/%E6%96%B0%E8%A6%8F.txt

      Cookie: _redmine_session=BAh7CjoMdXNlcl9pZGkHOg9zZXNzaW9uX2lkIiUyYWNmZjdiNzk5NDdlNGRiMzZhYjNlY2UyOTc3YWFmNToQX2NzcmZfdG9rZW4iMWp5cGV3d253V2txTzd1QzVEeEJaL3RHN1NOU2dndUZxckZrOHM3NjNrc289OgpxdWVyeXsJOg9wcm9qZWN0X2lkaSc6DGZpbHRlcnN7BiIOc3RhdHVzX2lkewc6DW9wZXJhdG9yIgZvOgt2YWx1ZXNbBiIAOg1ncm91cF9ieTA6EWNvbHVtbl9uYW1lczAiFmlzc3Vlc19pbmRleF9zb3J0IgxpZDpkZXNj--a800a7b6efc0b1f730e5422b4e06b6ed6edcba3b

       

      HTTP/1.1 200 OK

      Date: Fri, 13 Jan 2012 05:28:11 GMT

      Server: Apache-Coyote/1.1

      Content-Disposition: attachment; filename="ー・txt"

      Content-Transfer-Encoding: binary

      Cache-Control: private

      X-Runtime: 15

      Content-Type: text/plain

      Vary: Accept-Encoding

      Content-Encoding: gzip

      Content-Length: 26

      Set-Cookie: _redmine_session=BAh7CjoMdXNlcl9pZGkHOg9zZXNzaW9uX2lkIiUyYWNmZjdiNzk5NDdlNGRiMzZhYjNlY2UyOTc3YWFmNToQX2NzcmZfdG9rZW4iMWp5cGV3d253V2txTzd1QzVEeEJaL3RHN1NOU2dndUZxckZrOHM3NjNrc289OgpxdWVyeXsJOg9wcm9qZWN0X2lkaSc6DGZpbHRlcnN7BiIOc3RhdHVzX2lkewc6DW9wZXJhdG9yIgZvOgt2YWx1ZXNbBiIAOg1ncm91cF9ieTA6EWNvbHVtbl9uYW1lczAiFmlzc3Vlc19pbmRleF9zb3J0IgxpZDpkZXNj--a800a7b6efc0b1f730e5422b4e06b6ed6edcba3b; path=/; HttpOnly

      Keep-Alive: timeout=5, max=2000

      Connection: Keep-Alive

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

       

      Headers using JRuby + WEBrick:

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

      GET /attachments/download/1/%E6%96%B0%E8%A6%8F.txt HTTP/1.1

      Host: localhost:3000

      User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1

      Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

      Accept-Language: ja,en-us;q=0.7,en;q=0.3

      Accept-Encoding: gzip, deflate

      Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7

      Connection: keep-alive

      Referer: http://localhost:3000/attachments/1/%E6%96%B0%E8%A6%8F.txt

      Cookie: _redmine_session=BAh7CjoMdXNlcl9pZGkGOg9zZXNzaW9uX2lkIiVkNjgzYzk4YzI3MjEzYmEwMjE0MjMyYzU4YWU0MjkxYjoQX2NzcmZfdG9rZW4iMWZRTXNEVW8wN1MwR3l4ai96em9xek1hMmNkMTRhTGh2Mi9OcVBnRE9vbzg9OgpxdWVyeXsJOg9wcm9qZWN0X2lkaQY6DGZpbHRlcnN7BiIOc3RhdHVzX2lkewc6DW9wZXJhdG9yIgZvOgt2YWx1ZXNbBiIAOg1ncm91cF9ieTA6EWNvbHVtbl9uYW1lczAiFmlzc3Vlc19pbmRleF9zb3J0IgxpZDpkZXNj--ffa45b05560e63395ecb43b796770f9997db045d

       

      HTTP/1.1 200 OK

      Content-Type: text/plain

      Content-Disposition: attachment; filename="新規.txt"

      Content-Transfer-Encoding: binary

      Cache-Control: private

      X-Runtime: 15

      Content-Length: 6

      Server: WEBrick/1.3.1 (Ruby/1.8.7/2011-05-23)

      Date: Fri, 13 Jan 2012 05:30:22 GMT

      Connection: Keep-Alive

      Set-Cookie: _redmine_session=BAh7CjoMdXNlcl9pZGkGOg9zZXNzaW9uX2lkIiVkNjgzYzk4YzI3MjEzYmEwMjE0MjMyYzU4YWU0MjkxYjoQX2NzcmZfdG9rZW4iMWZRTXNEVW8wN1MwR3l4ai96em9xek1hMmNkMTRhTGh2Mi9OcVBnRE9vbzg9OgpxdWVyeXsJOg9wcm9qZWN0X2lkaQY6DGZpbHRlcnN7BiIOc3RhdHVzX2lkewc6DW9wZXJhdG9yIgZvOgt2YWx1ZXNbBiIAOg1ncm91cF9ieTA6EWNvbHVtbl9uYW1lczAiFmlzc3Vlc19pbmRleF9zb3J0IgxpZDpkZXNj--ffa45b05560e63395ecb43b796770f9997db045d; path=/; HttpOnly

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

       

      The response contains a garbled filename in the "Content-Disposition" using the JBoss setup.