You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by "Peter Norsker (JIRA)" <ji...@apache.org> on 2009/09/22 11:13:16 UTC
[jira] Created: (JSPWIKI-602) Encoding hardcoded when uploading
attachment
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.
[jira] Commented: (JSPWIKI-602) Encoding hardcoded when uploading
attachment
Posted by "Peter Norsker (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JSPWIKI-602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12758435#action_12758435 ]
Peter Norsker commented on JSPWIKI-602:
---------------------------------------
Ok, but what about the upgrade path for older installations of JSPWiki?! We have a rather large wiki at the moment which is based on Latin1 and we would not be able to upgrade if this is not supported in future versions.
> 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.
[jira] Resolved: (JSPWIKI-602) Encoding hardcoded when uploading
attachment
Posted by "Peter Norsker (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JSPWIKI-602?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Peter Norsker resolved JSPWIKI-602.
-----------------------------------
Resolution: Won't Fix
> 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.
[jira] Commented: (JSPWIKI-602) Encoding hardcoded when uploading
attachment
Posted by "Peter Norsker (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JSPWIKI-602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12758595#action_12758595 ]
Peter Norsker commented on JSPWIKI-602:
---------------------------------------
We will give it a shot, and try to convert the files. I guess we also have to switch servlet container, we are using Tomcat at the moment, since Tomcat have a problem with UTF-8 encoding unless you set it on the container top level.
This is not an option though, wince we have a lot of applicationens, which are not using UTF-8, so we have to start a new container for JSPWiki with UTF-8 support.
Thank you for your time. I will change the status to "wont fix"
> 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.
[jira] Commented: (JSPWIKI-602) Encoding hardcoded when uploading
attachment
Posted by "Erik Bunn (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Commented: (JSPWIKI-602) Encoding hardcoded when uploading
attachment
Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JSPWIKI-602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12758424#action_12758424 ]
Janne Jalkanen commented on JSPWIKI-602:
----------------------------------------
Running with Latin1 is deprecated in 2.8.x series. Workaround is to switch to UTF-8. Propose WONTFIX.
(3.0 should run with UTF-8 only.)
> 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.
[jira] Commented: (JSPWIKI-602) Encoding hardcoded when uploading
attachment
Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
[ 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.