Sha256: a7e1361e6a5a380c536e65dc9e5738d329bb6c8e75d3470fa3f925939d89ca54

Contents?: true

Size: 746 Bytes

Versions: 145

Compression:

Stored size: 746 Bytes

Contents

module REXML
  module Encoding
    def encode_unile content
      array_utf8 = content.unpack("U*")
      array_enc = []
      array_utf8.each do |num|
        if ((num>>16) > 0)
          array_enc << ??
          array_enc << 0
        else
          array_enc << (num & 0xFF)
          array_enc << (num >> 8)
        end
      end
      array_enc.pack('C*')
    end

    def decode_unile(str)
      array_enc=str.unpack('C*')
      array_utf8 = []
      0.step(array_enc.size-1, 2){|i| 
        array_utf8 << (array_enc.at(i) + array_enc.at(i+1)*0x100)
      }
      array_utf8.pack('U*')
    end

    register(UNILE) do |obj|
      class << obj
        alias decode decode_unile
        alias encode encode_unile
      end
    end
  end
end

Version data entries

145 entries across 145 versions & 5 rubygems

Version Path
rhodes-7.6.0 lib/extensions/rexml/rexml/encodings/UNILE.rb
rhodes-7.5.1 lib/extensions/rexml/rexml/encodings/UNILE.rb
rhodes-7.4.1 lib/extensions/rexml/rexml/encodings/UNILE.rb
rhodes-7.1.17 lib/extensions/rexml/rexml/encodings/UNILE.rb
rhodes-6.2.0 lib/extensions/rexml/rexml/encodings/UNILE.rb
rhodes-6.0.11 lib/extensions/rexml/rexml/encodings/UNILE.rb
rhodes-5.5.18 lib/extensions/rexml/rexml/encodings/UNILE.rb
rhodes-5.5.17 lib/extensions/rexml/rexml/encodings/UNILE.rb
rhodes-5.5.15 lib/extensions/rexml/rexml/encodings/UNILE.rb
rhodes-5.5.0.22 lib/extensions/rexml/rexml/encodings/UNILE.rb
rhodes-5.5.2 lib/extensions/rexml/rexml/encodings/UNILE.rb
rhodes-5.5.0.7 lib/extensions/rexml/rexml/encodings/UNILE.rb
rhodes-5.5.0.3 lib/extensions/rexml/rexml/encodings/UNILE.rb
rhodes-5.5.0 lib/extensions/rexml/rexml/encodings/UNILE.rb
tauplatform-1.0.3 lib/extensions/rexml/rexml/encodings/UNILE.rb
tauplatform-1.0.2 lib/extensions/rexml/rexml/encodings/UNILE.rb
tauplatform-1.0.1 lib/extensions/rexml/rexml/encodings/UNILE.rb
rubysl-rexml-1.0.0 lib/rexml/encodings/UNILE.rb
ruby_on_ruby-0.0.1 vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UNILE.rb
rhodes-3.5.1.12 lib/extensions/rexml/rexml/encodings/UNILE.rb