mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 11:14:00 +00:00
Properly handle XML entities on reading (Tracker #3284508)
This commit is contained in:
parent
ec927024f5
commit
4a5e1574ca
|
@ -16,15 +16,26 @@ class PlistData
|
||||||
end
|
end
|
||||||
|
|
||||||
def _encodeEntities(string)
|
def _encodeEntities(string)
|
||||||
encoded = []
|
encoded = ''
|
||||||
string.unpack('U*').each do |ch|
|
string.unpack('U*').each do |ch|
|
||||||
if ch <= 0x7F
|
case ch
|
||||||
|
when 0x22
|
||||||
|
encoded.concat('"')
|
||||||
|
when 0x26
|
||||||
|
encoded.concat('&')
|
||||||
|
when 0x27
|
||||||
|
encoded.concat(''')
|
||||||
|
when 0x3C
|
||||||
|
encoded.concat('<')
|
||||||
|
when 0x3E
|
||||||
|
encoded.concat('>')
|
||||||
|
when 0..0x7F
|
||||||
encoded << ch
|
encoded << ch
|
||||||
else
|
else
|
||||||
encoded.concat("&\##{ch};".unpack('C*'))
|
encoded.concat("&\##{ch};")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
encoded.pack('C*')
|
encoded
|
||||||
end
|
end
|
||||||
|
|
||||||
def _encodePlist(destination, object, indent)
|
def _encodePlist(destination, object, indent)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user