You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by "Rich Scheuerle (JIRA)" <ji...@apache.org> on 2007/02/17 16:53:05 UTC
[jira] Created: (WSCOMMONS-168) Multi-part boundary calculation is
using the wrong character set.
Multi-part boundary calculation is using the wrong character set.
-----------------------------------------------------------------
Key: WSCOMMONS-168
URL: https://issues.apache.org/jira/browse/WSCOMMONS-168
Project: WS-Commons
Issue Type: Bug
Components: AXIOM
Reporter: Rich Scheuerle
Assigned To: Rich Scheuerle
MIMEOutputUtils uses the following code to write out the boundary
/**
* @throws IOException
* This will write the boundary to output Stream
*/
public static void writeMimeBoundary(OutputStream outStream,
String boundary) throws IOException {
outStream.write(new byte[]{45, 45});
outStream.write(boundary.getBytes());
}
Note that 45 is the UTF-8 character for "-". However the boundary bytes are obtained using the default charset. This code fails on an EBCDIC based machine.
The tactical solution is to change the code to make it consistent (see full solution at the end of this remark):
outStream.write(new byte[]{45, 45});
outStream.write(boundary.getBytes("UTF-8")); <---------------
A similar change is needed in Attachments.java where the boundary is read:
Currently:
// Boundary always have the prefix "--".
this.boundary = ("--" + contentType.getParameter("boundary"))
.getBytes();
Proposed:
// Boundary always have the prefix "--".
this.boundary = ("--" + contentType.getParameter("boundary"))
.getBytes("UTF-8"); <-----------------------
----------------------------------------------------------------------
The full solution is to change the code to respect the charset of the message.
However, I believe that this will cause problems in the lower level boundary delimitted stream code and other lower level classes.
I believe the lower level classes have hard-code checks for UTF-8 characters and assume 1-byte character lengths.
This jira covers the tactical solution. I will open a separate jira to address the full solution.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org
[jira] Resolved: (WSCOMMONS-168) Multi-part boundary calculation is
using the wrong character set.
Posted by "Rich Scheuerle (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WSCOMMONS-168?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rich Scheuerle resolved WSCOMMONS-168.
--------------------------------------
Resolution: Fixed
Committed revision 508793.
> Multi-part boundary calculation is using the wrong character set.
> -----------------------------------------------------------------
>
> Key: WSCOMMONS-168
> URL: https://issues.apache.org/jira/browse/WSCOMMONS-168
> Project: WS-Commons
> Issue Type: Bug
> Components: AXIOM
> Reporter: Rich Scheuerle
> Assigned To: Rich Scheuerle
>
> MIMEOutputUtils uses the following code to write out the boundary
> /**
> * @throws IOException
> * This will write the boundary to output Stream
> */
> public static void writeMimeBoundary(OutputStream outStream,
> String boundary) throws IOException {
> outStream.write(new byte[]{45, 45});
> outStream.write(boundary.getBytes());
> }
> Note that 45 is the UTF-8 character for "-". However the boundary bytes are obtained using the default charset. This code fails on an EBCDIC based machine.
> The tactical solution is to change the code to make it consistent (see full solution at the end of this remark):
> outStream.write(new byte[]{45, 45});
> outStream.write(boundary.getBytes("UTF-8")); <---------------
> A similar change is needed in Attachments.java where the boundary is read:
> Currently:
> // Boundary always have the prefix "--".
> this.boundary = ("--" + contentType.getParameter("boundary"))
> .getBytes();
> Proposed:
> // Boundary always have the prefix "--".
> this.boundary = ("--" + contentType.getParameter("boundary"))
> .getBytes("UTF-8"); <-----------------------
> ----------------------------------------------------------------------
> The full solution is to change the code to respect the charset of the message.
> However, I believe that this will cause problems in the lower level boundary delimitted stream code and other lower level classes.
> I believe the lower level classes have hard-code checks for UTF-8 characters and assume 1-byte character lengths.
> This jira covers the tactical solution. I will open a separate jira to address the full solution.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org