incubator-jspwiki-dev mailing list archives

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

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

Janne Jalkanen commented on JSPWIKI-602:
----------------------------------------

JSPWiki actually upgrades your pages transparently from Latin1 to UTF-8, if you just switch
the encoding.  It'll still read pages written in Latin1, but will save them back in UTF-8
whenever a page is edited.  So all you need to do is to switch the encoding, and you should
be fine.

No need for recode :)

> 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