aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/http/headers/accept-charset/index.html
blob: 26433c22db8629f3af334916ca20b80b015c8c4b (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
title: Accept-Charset
slug: Web/HTTP/Headers/Accept-Charset
tags:
  - Negociación de Contenido
translation_of: Web/HTTP/Headers/Accept-Charset
---
<div>{{HTTPSidebar}}</div>

<p>The <strong><code>Accept-Charset</code></strong> request HTTP header advertises which character set the client is able to understand. Using <a href="/en-US/docs/Web/HTTP/Content_negotiation">content negotiation</a>, the server then selects one of the proposals, uses it and informs the client of its choice within the {{HTTPHeader("Content-Type")}} response header. Browsers usually don't set this header as the default value for each content type is usually correct and transmitting it would allow easier fingerprinting.</p>

<p>If the server cannot serve any matching character set, it can theoretically send back a {{HTTPStatus("406")}} (Not Acceptable) error code. But, for a better user experience, this is rarely done and the more common way is to ignore the <code>Accept-Charset</code> header in this case.</p>

<div class="note">
<p>In early versions of HTTP/1.1, a default charset (<code>ISO-8859-1</code>) was defined. This is no more the case and now each content type may have its own default.</p>
</div>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">Header type</th>
   <td>{{Glossary("Request header")}}</td>
  </tr>
  <tr>
   <th scope="row">{{Glossary("Forbidden header name")}}</th>
   <td>yes</td>
  </tr>
 </tbody>
</table>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">Accept-Charset: &lt;charset&gt;

// Multiple types, weighted with the {{glossary("quality values", "quality value")}} syntax:
Accept-Charset: utf-8, iso-8859-1;q=0.5</pre>

<h2 id="Directives">Directives</h2>

<dl>
 <dt><code>&lt;charset&gt;</code></dt>
 <dd>Un conjunto de caracteres como <code>utf-8</code> o <code>iso-8859-15.</code></dd>
 <dt><code>*</code></dt>
 <dd>Any charset not mentioned elsewhere in the header; <code>'*'</code> being used as a wildcard.</dd>
 <dt><code>;q=</code> (q-factor weighting)</dt>
 <dd>Any value is placed in an order of preference expressed using a relative <a href="/en-US/docs/Glossary/Quality_values">quality value</a> called the <em>weight</em>.</dd>
</dl>

<h2 id="Examples">Examples</h2>

<pre>Accept-Charset: iso-8859-1

Accept-Charset: utf-8, iso-8859-1;q=0.5

Accept-Charset: utf-8, iso-8859-1;q=0.5, *;q=0.1
</pre>

<h2 id="Especificaciones">Especificaciones</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Especificación</th>
   <th scope="col">Título</th>
  </tr>
  <tr>
   <td>{{RFC("7231", "Accept-Charset", "5.3.3")}}</td>
   <td>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Context</td>
  </tr>
 </tbody>
</table>

<h2 id="Compatibilidad_del_navegador">Compatibilidad del navegador</h2>



<p>{{Compat("http.headers.Accept-Charset")}}</p>

<h2 id="También_puedes_revisar">También puedes revisar:</h2>

<ul>
 <li>HTTP <a href="/en-US/docs/Web/HTTP/Content_negotiation">content negotiation</a></li>
 <li>Encabezados conlos resultados de la negociación de contenido: {{HTTPHeader("Content-Type")}}</li>
 <li>Otros encabezados similares: {{HTTPHeader("TE")}}, {{HTTPHeader("Accept-Encoding")}}, {{HTTPHeader("Accept-Language")}}, {{HTTPHeader("Accept")}}</li>
</ul>