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.