Skip to content

Commit a7f7863

Browse files
committed
Updated default charset to UTF-8
1 parent 60c5c3e commit a7f7863

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

browsermob-core/src/main/java/net/lightbody/bmp/util/BrowserMobHttpUtil.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,18 @@ public class BrowserMobHttpUtil {
4242
public static final String UNKNOWN_CONTENT_TYPE = "application/octet-stream";
4343

4444
/**
45-
* The default charset when the Content-Type header does not specify a charset. From the HTTP 1.1 spec section 3.7.1:
45+
* The default charset when the Content-Type header does not specify a charset. According to RFC 7231 Appendix B:
4646
* <pre>
47-
* When no explicit charset parameter is provided by the sender, media subtypes of the "text" type are defined to have a default
48-
* charset value of "ISO-8859-1" when received via HTTP. Data in character sets other than "ISO-8859-1" or its subsets MUST be
49-
* labeled with an appropriate charset value.
47+
* The default charset of ISO-8859-1 for text media types has been
48+
* removed; the default is now whatever the media type definition says.
49+
* Likewise, special treatment of ISO-8859-1 has been removed from the
50+
* Accept-Charset header field.
5051
* </pre>
52+
*
53+
* Technically, we would have to determine the charset on a per-content-type basis, but generally speaking, UTF-8 is a
54+
* pretty safe default. (NOTE: In the previous HTTP/1.1 spec, section 3.7.1, the default charset was defined as ISO-8859-1.)
5155
*/
52-
public static final Charset DEFAULT_HTTP_CHARSET = StandardCharsets.ISO_8859_1;
56+
public static final Charset DEFAULT_HTTP_CHARSET = StandardCharsets.UTF_8;
5357

5458
/**
5559
* Buffer size when decompressing content.

0 commit comments

Comments
 (0)