lib/vcard.rb in vcard-0.2.5 vs lib/vcard.rb in vcard-0.2.6
- old
+ new
@@ -182,10 +182,10 @@
end
end
end
def self.encode_text(v) #:nodoc:
- v.to_str.gsub(/([\\,;\n])/) { $1 == "\n" ? "\\n" : "\\#{$1}" }
+ v.to_str.gsub(/[\\,;]/, '\\\\\0').gsub(/\r?\n/, "\\n")
end
# v is an Array of String, or just a single String
def self.encode_text_list(v, sep = ",") #:nodoc:
v.to_ary.map { |t| encode_text(t) }.join(sep)