/usr/share/doc/libcommons-httpclient-java/docs/charencodings.html is in libcommons-httpclient-java-doc 3.1-14.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>HttpClient - Character Encodings</title><style type="text/css" media="all">
@import url("./style/maven-base.css");
@import url("./style/maven-theme.css");@import url("./style/project.css");</style><link rel="stylesheet" href="./style/print.css" type="text/css" media="print"></link><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></meta><meta name="author" content="Adrian Sutton"></meta><meta name="email" content="adrian@ephox.com"></meta><meta name="author" content="Jeff Dever"></meta><meta name="email" content="jsdever@apache.org"></meta></head><body class="composite"><div id="banner"><a href="http://jakarta.apache.org/" id="organizationLogo"><img alt="Apache Software Foundation" src=""></img></a><a href="http://jakarta.apache.org/httpcomponents/httpclient-3.x/" id="projectLogo"><img alt="HttpClient" src="./images/httpclient_logo.png"></img></a><div class="clear"><hr></hr></div></div><div id="breadcrumbs"><div class="xleft">Last published: 18 August 2007
<span class="separator">|</span> Doc for 3.1
</div><div class="xright"></div><div class="clear"><hr></hr></div></div><div id="leftColumn"><div id="navcolumn"><div id="menuOverview"><h5>Overview</h5><ul><li class="none"><a href="features.html">Features</a></li><li class="none"><a href="news.html">News</a></li><li class="none"><a href="status.html">Status</a></li><li class="none"><a href="downloads.html">Download</a></li><li class="none"><a href="http://wiki.apache.org/jakarta-httpclient/" class="externalLink" title="External Link">Wiki</a></li><li class="expanded"><a href="userguide.html">User Guide</a><ul><li class="none"><a href="authentication.html">Authentication Guide</a></li><li class="none"><strong><a href="charencodings.html">Character Encodings</a></strong></li><li class="none"><a href="cookies.html">Cookies</a></li><li class="none"><a href="exception-handling.html">Exception Handling</a></li><li class="none"><a href="logging.html">Logging Guide</a></li><li class="none"><a href="methods.html">Methods</a></li><li class="none"><a href="performance.html">Optimization Guide</a></li><li class="none"><a href="preference-api.html">Preference Architecture</a></li><li class="none"><a href="redirects.html">Redirects Handling</a></li><li class="none"><a href="http://svn.apache.org/viewvc/jakarta/httpcomponents/oac.hc3x/trunk/src/examples/" class="externalLink" title="External Link">Sample Code</a></li><li class="none"><a href="sslguide.html">SSL Guide</a></li><li class="none"><a href="threading.html">Threading</a></li><li class="none"><a href="troubleshooting.html">Trouble Shooting</a></li><li class="none"><a href="tutorial.html">Tutorial</a></li></ul></li><li class="none"><a href="developerguide.html">Developer Guide</a></li></ul></div><div id="menuProject_Documentation"><h5>Project Documentation</h5><ul><li class="none"><a href="index.html">About</a></li><li class="collapsed"><a href="project-info.html">Project Info</a></li><li class="collapsed"><a href="maven-reports.html">Project Reports</a></li><li class="none"><a href="development-process.html">Development Process</a></li></ul></div><div id="legend"><h5>Legend</h5><ul><li class="externalLink">External Link</li><li class="newWindow">Opens in a new window</li></ul></div><a href="http://maven.apache.org/" title="Built by Maven" id="poweredBy"><img alt="Built by Maven" src="./images/logos/mavenlogo_builtby_w.png"></img></a></div></div><div id="bodyColumn"><div class="contentBox"><div class="section"><a name="Introduction"></a><h2>Introduction</h2>
<p>This document provides an overview of how HttpClient handles character
encodings and how to use HttpClient in an encoding safe way. There are
three main sections:
<a href="#HTTP_Headers">HTTP Headers</a>,
<a href="#Request_Response_Body">Request/Response Body</a> and
<a href="#URLs">URLs</a>.
</p>
</div><div class="section"><a name="HTTP_Headers"></a><h2>HTTP Headers</h2>
<p>The headers of a HTTP request or response must be in <tt>US-ASCII</tt> format.
It is not possible to use non <tt>US-ASCII</tt> characters in the header of a
request or response. Generally this is not an issue however, because the
HTTP headers are designed to facilite the transfer of data rather than to
actually transfer the data itself.</p>
<p>One exception however are cookies. Since cookies are transfered as HTTP Headers
they are confined to the <tt>US-ASCII</tt> character set. See the Cookie Guide
for more information.
</p>
</div><div class="section"><a name="Request_Response_Body"></a><h2>Request/Response Body</h2>
<p>The request or response body can be any encoding, but by default is
<tt>ISO-8859-1</tt>. The encoding may be specified in the
<tt>Content-Type</tt> header, for example:
<blockquote>Content-Type: text/html; charset=UTF-8</blockquote>
</p>
<p>In this case the application should be careful to use UTF-8 encoding
when converting the body to a String or some characters may be corrupt.
You can set the content type header for a request with the
<code>addRequestHeader</code> method in each method and retrieve the
encoding for the response body with the <code>getResponseCharSet</code>
method.</p>
<p>If the response is known to be a String, you can use the
<code>getResponseBodyAsString</code> method which will automatically use
the encoding specified in the <tt>Content-Type</tt> header or
<tt>ISO-8859-1</tt> if no charset is specified.</p>
<p>Note that some document types, such as HTML and XML allow the author
to specify the content type of the file. In this case, you should
consult the appropriate standards regarding how to resovle any conflicts
in the reported charsets.</p>
</div><div class="section"><a name="URLs"></a><h2>URLs</h2>
<p>The standard for URLs (<a href="http://www.ietf.org/rfc/rfc1738.txt" class="externalLink" title="External Link">RFC1738</a>) explictly
states that URLs may only contain graphic printable characters of the
<tt>US-ASCII</tt> coded character set and is defined in terms of octets.
The octets <code>80-FF</code> hexadecimal are not used in <tt>US-ASCII</tt> and the octets
<code>OO-1F</code> hexadecimal represent control characters; characters in these
ranges must be encoded.</p>
<p>Characters which cannot be represented by an 8-bit ASCII code, can not
be used in an URL as there is no way to reliably encode them (the
encoding scheme for URLs is based off of octets). Despite this, some
servers do support varying means of encoding double byte characters in
URLs, the most common technique seems to be to use UTF-8 encoding and
encode each octet separately even if a pair of octets represents one
character. This however, is not specified by the standard and is highly
prone to error, so it is recommended that URLs be restricted to the 8-bit
ASCII range.</p>
</div></div></div><div class="clear"><hr></hr></div><div id="footer"><div class="xright">© 2001-2007, Apache Software Foundation</div><div class="clear"><hr></hr></div></div></body></html>
|