incubator-jspwiki-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Bunn (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JSPWIKI-602) Encoding hardcoded when uploading attachment
Date Wed, 23 Sep 2009 03:22:16 GMT

    [ https://issues.apache.org/jira/browse/JSPWIKI-602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12758561#action_12758561
] 

Erik Bunn commented on JSPWIKI-602:
-----------------------------------

At the risk of stating the obvious:

I would suggest going through the chore of converting the page base to UTF-8. You'll be thankful
later.
With the file system based providers, it's fairly simple; 'iconv' or 'recode' can do the job.

With databases, there will be a bit more effort, of course.
 
Best to work with a mirror - I remember managing to mangle something when we did this. Haven't
regretted, though.




> Encoding hardcoded when uploading attachment
> --------------------------------------------
>
>                 Key: JSPWIKI-602
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-602
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.8.2
>            Reporter: Peter Norsker
>
> In the AttachmentServlet in the upload method, the encoding UTF-8 is hardcoded. This
make the upload break when uploading to a wiki page with international charaters (such as
æøå in the danish language) and the wiki runs with encoding ISO-8859-1. The encoding used
in this servlet should be fetched from the WikiEngine instead of being hardcoded.
> I have made a fix for our installation in this class by adding the following to the upload
method:
> -- snip --
>             // Create the context _before_ Multipart operations, otherwise
>             // strict servlet containers may fail when setting encoding.
>             WikiContext context = m_engine.createContext( req, WikiContext.ATTACH );
>             String encoding = context.getEngine().getContentEncoding(); // part of fix
>             UploadListener pl = new UploadListener();
>             m_engine.getProgressManager().startProgress( pl, progressId );
>             ServletFileUpload upload = new ServletFileUpload(factory);
>             upload.setHeaderEncoding(encoding); // part of fix
>             upload.setFileSizeMax( m_maxSize );
> -- snip --
>                         wikipage = item.getString(encoding); // part of fix
>                         int x = wikipage.indexOf("/");
>                         if( x != -1 ) wikipage = wikipage.substring(0,x);
>                     }
>                     else if( item.getFieldName().equals("changenote") )
>                     {
>                         changeNote = item.getString(encoding);  // part of fix
>                     }
>                     else if( item.getFieldName().equals( "nextpage" ) )
>                     {
>                         nextPage = validateNextPage( item.getString(encoding), errorPage
);  // part of fix
> -- snip --

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message