diff options
Diffstat (limited to 'lib/rexml/functions.rb')
-rw-r--r-- | lib/rexml/functions.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/rexml/functions.rb b/lib/rexml/functions.rb index 8293e9c5ac..b3c89877e5 100644 --- a/lib/rexml/functions.rb +++ b/lib/rexml/functions.rb @@ -256,9 +256,15 @@ module REXML end } - string(string).unpack('U*').collect { |c| - if map.has_key? c then map[c] else c end - }.compact.pack('U*') + if ''.respond_to? :chars + string(string).chars.collect { |c| + if map.has_key? c then map[c] else c end + }.compact.join + else + string(string).unpack('U*').collect { |c| + if map.has_key? c then map[c] else c end + }.compact.pack('U*') + end end # UNTESTED |