From 87acdae43dcfab5d28c85b10374be9faf6209076 Mon Sep 17 00:00:00 2001 From: hsbt Date: Tue, 16 May 2017 09:32:32 +0000 Subject: Strip punctuation from CSV headers in symbol converter. Patch by @cllns. [Fix GH-957] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/csv.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/csv.rb') diff --git a/lib/csv.rb b/lib/csv.rb index 30e4b23586..336b42a697 100644 --- a/lib/csv.rb +++ b/lib/csv.rb @@ -1014,8 +1014,8 @@ class CSV HeaderConverters = { downcase: lambda { |h| h.encode(ConverterEncoding).downcase }, symbol: lambda { |h| - h.encode(ConverterEncoding).downcase.strip.gsub(/\s+/, "_"). - gsub(/\W+/, "").to_sym + h.encode(ConverterEncoding).downcase.gsub(/[^[\s\w]]+/, "").strip. + gsub(/\s+/, "_").to_sym } } -- cgit v1.2.3