Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313029 - HttpClient gets http content in ISO-8859-1 instead UTF-8
Summary: HttpClient gets http content in ISO-8859-1 instead UTF-8
Status: RESOLVED FIXED
Alias: None
Product: ECF
Classification: RT
Component: ecf.remoteservices (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: ecf.core-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-16 03:27 EDT by Pavel Samolisov CLA
Modified: 2010-05-16 12:45 EDT (History)
2 users (show)

See Also:


Attachments
patch, that fixed this bug (1.62 KB, patch)
2010-05-16 03:30 EDT, Pavel Samolisov CLA
slewis: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Samolisov CLA 2010-05-16 03:27:59 EDT
Build Identifier: 

HttpClient gets http content in its default encoding - ISO-8859-1. If page content contains do not ASCII symbols, they transform to unreadable symbols sequences, for example: По просьбам читателей.

I made small patch - add in method createAndPrepareHttpMethod(...) of class RestClientService folows string: 

httpClient.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, DEFAULT_HTTP_CONTENT_CHARSET);

DEFAULT_HTTP_CONTENT_CHARSET is java constant:

protected final static String DEFAULT_HTTP_CONTENT_CHARSET = "UTF-8"; //$NON-NLS-1$

Reproducible: Always
Comment 1 Pavel Samolisov CLA 2010-05-16 03:30:27 EDT
Created attachment 168644 [details]
patch, that fixed this bug
Comment 2 Scott Lewis CLA 2010-05-16 12:00:26 EDT
Hi Pavel,

I can apply this patch, but would like to ask one question

To your knowledge, is there any possibility of regression (breaking something else) by applying this patch.  If so, what?
Comment 3 Pavel Samolisov CLA 2010-05-16 12:07:36 EDT
Thanks, Scott

I think this patch does not breake anything. If ECF REST client is trying to get data from URL with content by ASCII symbols only - it will get correcting content. This one just set correct behavior for not ASCII content.
Comment 4 Scott Lewis CLA 2010-05-16 12:18:35 EDT
Ok Pavel.  Thanks.  One thing to point out about this...it is possible for RestClientService subclasses to override createAndPrepareHttpMethod and set the options for the HttpMethod as desired.

I've applied patch, tested, and released to HEAD.  Thanks for the report and patch, Pavel.  Resolving as fixed.
Comment 5 Pavel Samolisov CLA 2010-05-16 12:45:50 EDT
Thanks, Scott! I think this is really will help for not english-language users.