[ruby-core:118259] [Ruby master Feature#20567] Net::HTTPResponse#detect_encoding should default to UTF-8 for application/javascript

Issue #20567 has been reported by postmodern (Hal Brodigan). ---------------------------------------- Feature #20567: Net::HTTPResponse#detect_encoding should default to UTF-8 for application/javascript https://bugs.ruby-lang.org/issues/20567 * Author: postmodern (Hal Brodigan) * Status: Open ---------------------------------------- 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](https://www.rfc-editor.org/rfc/rfc4329#section-4) also seems to encourage defaulting to UTF-8. -- https://bugs.ruby-lang.org/
participants (1)
-
postmodern (Hal Brodigan)