Project

General

Profile

Actions

Feature #20567

open

Net::HTTPResponse#detect_encoding should default to UTF-8 for application/javascript

Added by postmodern (Hal Brodigan) 14 days ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:118259]

Description

It is fairly common now for JavaScript to include UTF-8 characters. If a misconfigured web server returns an application/javascript response for a JavaScript file, but without charset=utf-8 in the Content-Type, Net::HTTPResponse will return a response body with encoding of ASCII-8BIT. This can cause lots of subtle String parsing/encoding issues when the response body is parsed or transformed. Net::HTTPResponse#detect_encoding should default the response encoding to UTF-8 if the Content-Type includes application/javascript.

RFC 4329 also seems to encourage defaulting to UTF-8.

No data to display

Actions

Also available in: Atom PDF

Like0