diff --git a/lib/po_to_json.rb b/lib/po_to_json.rb index 7902fd7..6144ec5 100644 --- a/lib/po_to_json.rb +++ b/lib/po_to_json.rb @@ -168,7 +168,7 @@ def assign_trans def push_buffer(value, key = nil) value = $1 if value =~ /^"(.*)"/ - value.gsub(/\\"/, "\"") + value.gsub!(/\\"/, "\"") if key.nil? buffer[lastkey] = [ diff --git a/spec/fixtures/test.po b/spec/fixtures/test.po index 71a5c52..345e6e6 100644 --- a/spec/fixtures/test.po +++ b/spec/fixtures/test.po @@ -67,3 +67,6 @@ msgstr "Du solltest '\\' als '\\\\' escapen." msgid "Umläüte" msgstr "Umlaute" + +msgid "contains double quote, say \"Hello\"" +msgstr "contains double quote, say \"Hello\"" diff --git a/spec/po_to_json_spec.rb b/spec/po_to_json_spec.rb index 553a13c..19021bf 100644 --- a/spec/po_to_json_spec.rb +++ b/spec/po_to_json_spec.rb @@ -111,6 +111,11 @@ eq(["Auto"]) ) end + it "should not espace double quote in msgid" do + expect( + subject["contains double quote, say \"Hello\""] + ).to be_truthy + end end describe "generate jed compatible" do