You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Jens Askengren (JIRA)" <ji...@apache.org> on 2010/01/14 13:42:54 UTC

[jira] Created: (HTTPCLIENT-905) HttpMethodBase.getResponseCharSet() returns ISO-8859-1 when no charset is specified in the Content-Type header

HttpMethodBase.getResponseCharSet() returns ISO-8859-1 when no charset is specified in the Content-Type header
--------------------------------------------------------------------------------------------------------------

                 Key: HTTPCLIENT-905
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-905
             Project: HttpComponents HttpClient
          Issue Type: Improvement
          Components: Documentation
    Affects Versions: 3.1 Final
            Reporter: Jens Askengren



If no charset is specified in the Content-Type  header, ISO-8859-1 is returned by HttpMethodBase.getResponseCharSet().
In this case I would expect NULL to be returned so my application can fall back on content sniffing when the return value is not trustworthy.

The HttpMethodBase.getResponseCharSet() and HttpMethodBase.getContentCharSet() methods seems to both return the charset specified in Content-Type header. What's the difference? The documentation is not clear.

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [jira] Created: (HTTPCLIENT-905) HttpMethodBase.getResponseCharSet() returns ISO-8859-1 when no charset is specified in the Content-Type header

Posted by 傅玉宝 <fu...@gmail.com>.
If no charset is specified in the Content-Type  header, ISO-8859-1 is
returned by HttpMethodBase
this is beacuse the HttpClient return the default charset which is
ISO-8859-1


2010/1/14 Jens Askengren (JIRA) <ji...@apache.org>

> HttpMethodBase.getResponseCharSet() returns ISO-8859-1 when no charset is
> specified in the Content-Type header
>
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-905
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-905
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 3.1 Final
>            Reporter: Jens Askengren
>
>
>
> If no charset is specified in the Content-Type  header, ISO-8859-1 is
> returned by HttpMethodBase.getResponseCharSet().
> In this case I would expect NULL to be returned so my application can fall
> back on content sniffing when the return value is not trustworthy.
>
> The HttpMethodBase.getResponseCharSet() and
> HttpMethodBase.getContentCharSet() methods seems to both return the charset
> specified in Content-Type header. What's the difference? The documentation
> is not clear.
>
> --
> 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: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>


-- 
fu

[jira] Resolved: (HTTPCLIENT-905) HttpMethodBase.getResponseCharSet() returns ISO-8859-1 when no charset is specified in the Content-Type header

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-905?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-905.
------------------------------------------

    Resolution: Invalid

http://www.faqs.org/rfcs/rfc2616.html

3.7.1 Canonicalization and Text Defaults
...
   The "charset" parameter is used with some media types to define the
   character set (section 3.4) of the data. When no explicit charset
   parameter is provided by the sender, media subtypes of the "text"
   type are defined to have a default charset value of "ISO-8859-1" when
   received via HTTP. 
...

As to your question, lots of things in the 3.x API simply do not make sense. 3.x is nearing end of life. You should consider upgrading to 4.0.x

Oleg

> HttpMethodBase.getResponseCharSet() returns ISO-8859-1 when no charset is specified in the Content-Type header
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-905
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-905
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 3.1 Final
>            Reporter: Jens Askengren
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> If no charset is specified in the Content-Type  header, ISO-8859-1 is returned by HttpMethodBase.getResponseCharSet().
> In this case I would expect NULL to be returned so my application can fall back on content sniffing when the return value is not trustworthy.
> The HttpMethodBase.getResponseCharSet() and HttpMethodBase.getContentCharSet() methods seems to both return the charset specified in Content-Type header. What's the difference? The documentation is not clear.

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org