[jira] [Commented] (OFBIZ-5186) HttpServletResponse content length cuts off serialized context (ofbiz.ser) when holds german umlauts

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-5186) HttpServletResponse content length cuts off serialized context (ofbiz.ser) when holds german umlauts

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-5186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13643715#comment-13643715 ]

Paul Foxworthy commented on OFBIZ-5186:
---------------------------------------

Hi Bruno,

Yes, a character with an umlaut will occupy more than one byte, and content length is in bytes not characters.

If the response is not too big, you could change the line to

response.setContentLength(resultString.getBytes("UTF-8").length);

If it is too big to justify translating to a byte array, there's a nice discussion of more efficient ways at

http://stackoverflow.com/questions/8511490/calculating-length-in-utf-8-of-java-string-without-actually-encoding-it

Please try and see if one of these fixes it.

Cheers

Paul Foxworthy
               

> HttpServletResponse content length cuts off serialized context (ofbiz.ser) when holds german umlauts
> ----------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-5186
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5186
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release 10.04
>         Environment: Ubuntu 10.04 TLS
>            Reporter: Bruno Wegmüller
>            Priority: Minor
>             Fix For: Release Branch 10.04
>
>
> When calling a remote Ofbiz Service over the httpService Engine, the serialized context (ofbiz.ser) is cut off at the end when german umlauts (äüö) are in the context. I think this happend because in the method HttpEngine.httpEngine there is a content length set:
> response.setContentLength(resultString.length());
> A german umlaut needs perhaps more space than an "normal" utf-8 character and the length of the content is wrong. Do you have a solution for this bug?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira