You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by bu...@apache.org on 2005/12/06 12:55:17 UTC
DO NOT REPLY [Bug 37805] New: -
misleading lack of javadoc in StringRequestEntity
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37805>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=37805
Summary: misleading lack of javadoc in StringRequestEntity
Product: HttpClient
Version: 3.0 RC4
Platform: Other
OS/Version: other
Status: NEW
Severity: normal
Priority: P2
Component: Commons HttpClient
AssignedTo: httpclient-dev@jakarta.apache.org
ReportedBy: poubelle2005@yahoo.fr
When using httpclient2, we were doing the following:
// Add the Content-type header. This sets the charset to UTF-8.
method.setRequestHeader( "Content-type", "text/xml; charset=UTF-8" );
// The given string is converted internally by the post method into
// a UTF-8 encoded byte array.
method.setRequestBody( xmlstring );
The comments show that this was the way we used to obtain a UTF-8 encoded XML
document (if this was wrong, that may be the origin of the problem?).
When upgrading to httpclient3 and killing deprecated code, this was converted to:
// Add the Content-type header. This sets the charset to UTF-8.
method.setRequestHeader( "Content-type", "text/xml; charset=UTF-8" );
// The given string is converted internally by the post method into
// a UTF-8 encoded byte array.
method.setRequestEntity( new StringRequestEntity( xmlstring ) );
which went without problem during the tests on my machine and on test production
machine.. because platforms charset were UTF-8, which is not the case for
production machines :(
I think the javadoc of the used StringRequestEntity constructor should strongly
state that it uses String#getBytes for the content, which uses the platform
charset. Also, I didn't notice any "upgrade to 3.x" documentation which would
have helped me :/
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org