Project

General

Profile

Actions

Feature #12869

open

open-uri's open rejects `BOM' in encoding

Added by emasaka (Masakazu Takahashi) over 7 years ago. Updated over 7 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-dev:49846]

Description

Kernel.#openのエンコード指定では、BOMへの対応も指定できます。

open('foo.txt', 'r:BOM|UTF-8') ...

open-uriが再定義したopenでURLをオープンするときにも同じ動作を期待して実行してみます。

require 'open-uri'
open('http://example.com/foo.txt', 'r:BOM|UTF-8') ...

しかし、エンコーディング指定のパースでエラーになります。

/path/to/lib/ruby/2.3.0/open-uri.rb:141:in `find': unknown encoding name - BOM|UTF-8 (ArgumentError)
Actions

Also available in: Atom PDF

Like0
Like0