From: "lhm (Lars Mai)" Date: 2013-07-03T22:39:08+09:00 Subject: [ruby-core:55778] [ruby-trunk - Bug #8599] CSV module - error when trying to set backslash as quote_char Issue #8599 has been updated by lhm (Lars Mai). Actually, I mistook quote_char for escape_char. Setting a backslash as quote_char is probably not a desired feature. I was looking for a way to escape double quotes differently than using two double quotes. Sorry for the noise. ---------------------------------------- Bug #8599: CSV module - error when trying to set backslash as quote_char https://bugs.ruby-lang.org/issues/8599#change-40272 Author: lhm (Lars Mai) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: 1.9.3-p392 Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN =begin There may be a bug in the CSV module. I found it impossible to set the backslash as quote_char, trying so gives the following: 1.9.3-p392 :055 > out = CSV.new($stdout, quote_char: "\\") RegexpError: premature end of char-class: /[^\]\[^\]/ I tried using Regexp.escape, too, but no luck: 1.9.3-p392 :060 > out = CSV.new($stdout, quote_char: Regexp.escape("\\")) ArgumentError: :quote_char has to be a single character String Is this expected behaviour? I'm not sure if it's related, but here the internal and external encodings: 1.9.3-p392 :061 > Encoding.default_external => # 1.9.3-p392 :062 > Encoding.default_internal => nil =end -- http://bugs.ruby-lang.org/