From: "duerst (Martin Dürst)" Date: 2013-11-12T14:27:52+09:00 Subject: [ruby-core:58286] [ruby-trunk - Bug #9096][Feedback] Regexp.quote(UTF-8) returns US-ASCII Issue #9096 has been updated by duerst (Martin D��rst). Status changed from Open to Feedback The encoding is set back to US-ASCII because the string is just 'foo'. If you change the string e.g. to "foo\u1234", then even after using Regexp.quote, it will keep UTF-8 as the encoding. A US-ASCII Regexp will match against any UTF-8 String the same way the corresponding UTF-8 Regexp will match (US-ASCII is treated as a common denominator in Ruby), so I don't think there should be any problems. In case you find any actual problems, please report back. ---------------------------------------- Bug #9096: Regexp.quote(UTF-8) returns US-ASCII https://bugs.ruby-lang.org/issues/9096#change-42877 Author: walles (Johan Walles) Status: Feedback Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN The attached program contains a unit test demonstrating that doing Regexp.quote() on an UTF-8 encoded string returns a US-ASCII encoded string (or at least I think it does...). I would expect Regexp.quote() to return a string with the same encoding as the input string. -- http://bugs.ruby-lang.org/