Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-4492

Importing filenames that contain non-ascii characters does not work

    XMLWordPrintable

Details

    • patch
    • Trivial

    Description

      The character set defaults to ISO-8859-1 in javax.servlet.ServletResponse. It should be set to something.

      The contents of the response to a "getPackageInfos" request are parsed from an xml-document ("package.xml" in the xar-file) and stored in a plain java string before inserted into the response. Since java strings are always unicode, I guess it is appropriate to hard-code UTF-8?

      The below patch works for me, anyway.

      Index: xwiki-core/src/main/java/com/xpn/xwiki/web/ImportAction.java
      ===================================================================
      --- xwiki-core/src/main/java/com/xpn/xwiki/web/ImportAction.java	(revision 24289)
      +++ xwiki-core/src/main/java/com/xpn/xwiki/web/ImportAction.java	(arbetskopia)
      @@ -37,7 +37,7 @@
       
                   // list files
                   if ("getPackageInfos".equals(action)) {
      -                response.setContentType("text/xml");
      +                response.setContentType("text/xml; charset=UTF-8");
                       XWikiAttachment packFile = doc.getAttachment(name);
                       importer.Import(packFile.getContent(context));
                       String xml = importer.toXml();
      
      

      Attachments

        Activity

          People

            sdumitriu Sergiu Dumitriu
            aj Andreas Jonsson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: