Project

General

Profile

Actions

Feature #747

closed

/\A/u ignores BOM

Added by shyouhei (Shyouhei Urabe) over 15 years ago. Updated almost 13 years ago.

Status:
Rejected
Target version:
[ruby-dev:37075]

Description

=begin
/\A/uがBOMにヒットしないのが嬉しくないです。普通、BOMはあるとすれば文字列の先頭に付いていることが多いので、/\A/uがBOMにヒットするのが自然だと思います。

あるいは/\Z/と/\z/のようにBOMにヒットする/\a/としない/\A/とかあってもいいかもしれませんが、いずれにせよBOMを適切に先頭とみなしてくれるメタキャラクタを希望します。でないと毎回 /\A(\xEF\xBB\xBF)?/uとか書かないといけなくなって非常に面倒です。

% ~/target/branches/ruby_1_9_1/bin/ruby -Ku -ve 'p /\Afoo/u =~ "\xEF\xBB\xBFfoo"'
ruby 1.9.1 (2008-11-12 revision 20221) [x86_64-linux]
-e:1: warning: ambiguous first argument; put parentheses or even spaces
nil
=end


Related issues 2 (0 open2 closed)

Related to Ruby master - Feature #802: IO.open optional argument to properly handle BOMsClosedmatz (Yukihiro Matsumoto)11/30/2008Actions
Related to Ruby master - Feature #1951: openのBOM指定拡張Closednaruse (Yui NARUSE)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0