diff options
Diffstat (limited to 'lib/rexml/encodings')
-rw-r--r-- | lib/rexml/encodings/CP-1252.rb | 2 | ||||
-rw-r--r-- | lib/rexml/encodings/ISO-8859-15.rb | 2 | ||||
-rw-r--r-- | lib/rexml/encodings/UNILE.rb | 2 | ||||
-rw-r--r-- | lib/rexml/encodings/UTF-16.rb | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/lib/rexml/encodings/CP-1252.rb b/lib/rexml/encodings/CP-1252.rb index 2ef6a1a291..587c5bdd68 100644 --- a/lib/rexml/encodings/CP-1252.rb +++ b/lib/rexml/encodings/CP-1252.rb @@ -58,7 +58,7 @@ module REXML end array_enc.pack('C*') end - + # Convert to UTF-8 def decode_cp1252(str) array_latin9 = str.unpack('C*') diff --git a/lib/rexml/encodings/ISO-8859-15.rb b/lib/rexml/encodings/ISO-8859-15.rb index 953267250e..08a19cb755 100644 --- a/lib/rexml/encodings/ISO-8859-15.rb +++ b/lib/rexml/encodings/ISO-8859-15.rb @@ -46,7 +46,7 @@ module REXML end array_enc.pack('C*') end - + # Convert to UTF-8 def from_iso_8859_15(str) array_latin9 = str.unpack('C*') diff --git a/lib/rexml/encodings/UNILE.rb b/lib/rexml/encodings/UNILE.rb index d054140c40..1a18f0c932 100644 --- a/lib/rexml/encodings/UNILE.rb +++ b/lib/rexml/encodings/UNILE.rb @@ -18,7 +18,7 @@ module REXML def decode_unile(str) array_enc=str.unpack('C*') array_utf8 = [] - 0.step(array_enc.size-1, 2){|i| + 0.step(array_enc.size-1, 2){|i| array_utf8 << (array_enc.at(i) + array_enc.at(i+1)*0x100) } array_utf8.pack('U*') diff --git a/lib/rexml/encodings/UTF-16.rb b/lib/rexml/encodings/UTF-16.rb index 007c493d9c..2ec058eed5 100644 --- a/lib/rexml/encodings/UTF-16.rb +++ b/lib/rexml/encodings/UTF-16.rb @@ -19,7 +19,7 @@ module REXML str = str[2..-1] if /^\376\377/n =~ str array_enc=str.unpack('C*') array_utf8 = [] - 0.step(array_enc.size-1, 2){|i| + 0.step(array_enc.size-1, 2){|i| array_utf8 << (array_enc.at(i+1) + array_enc.at(i)*0x100) } array_utf8.pack('U*') |