Do not encode single/double quotes as entities
By encoding single/double quotes we can potentially break input, so lets stop doing this. This now ensures that this: <foo>a"b</foo> Is actually serialized back into the exact same instead of being serialized into: <foo>a"b</foo>
This commit is contained in:
parent
098cd51ab7
commit
c97c1b6899
|
@ -28,8 +28,6 @@ module Oga
|
||||||
#
|
#
|
||||||
ENCODE_MAPPING = {
|
ENCODE_MAPPING = {
|
||||||
'&' => '&',
|
'&' => '&',
|
||||||
'"' => '"',
|
|
||||||
"'" => ''',
|
|
||||||
'>' => '>',
|
'>' => '>',
|
||||||
'<' => '<',
|
'<' => '<',
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,12 +80,12 @@ describe Oga::XML::Entities do
|
||||||
described_class.encode('&').should == '&'
|
described_class.encode('&').should == '&'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'encodes " as "' do
|
it 'does not encode double quotes' do
|
||||||
described_class.encode('"').should == '"'
|
described_class.encode('"').should == '"'
|
||||||
end
|
end
|
||||||
|
|
||||||
it "encodes ' as '" do
|
it 'does not encode single quotes' do
|
||||||
described_class.encode("'").should == '''
|
described_class.encode("'").should == "'"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'encodes < as <' do
|
it 'encodes < as <' do
|
||||||
|
|
Loading…
Reference in New Issue