Decoding of zero padded XML entities
This would previously fail due to the lack of an explicit base to use for Integer().
This commit is contained in:
parent
13e2c3d82f
commit
853d804f34
|
@ -72,7 +72,7 @@ module Oga
|
|||
|
||||
if input.include?(AMPERSAND)
|
||||
input = input.gsub(CODEPOINT_ENTITY) do |match|
|
||||
[$1 ? Integer($2, 16) : Integer($2)].pack('U')
|
||||
[$1 ? Integer($2, 16) : Integer($2, 10)].pack('U*')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -69,6 +69,10 @@ describe Oga::XML::Entities do
|
|||
it 'decodes < into <' do
|
||||
described_class.decode('<').should == '<'
|
||||
end
|
||||
|
||||
it 'decodes numeric entities starting with a 0' do
|
||||
described_class.decode('&').should == '&'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'encode' do
|
||||
|
|
Loading…
Reference in New Issue