Module: Origami::String::Encoding::UTF16BE

Defined in:
lib/origami/string.rb

Constant Summary collapse

MAGIC =
"\xFE\xFF"

Class Method Summary collapse

Class Method Details

.to_pdfdoc(str) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/origami/string.rb', line 95

def UTF16BE.to_pdfdoc(str)
  pdfdoc = []
  i = 2

  while i < str.size
    char = PDFDocEncoding::CHARMAP.index(str[i,2])
    raise EncodingError, "Can't convert UTF16-BE character to PDFDocEncoding" if char.nil?
    pdfdoc << char
    i = i + 2
  end

  pdfdoc.pack("C*")
end

.to_utf16be(str) ⇒ Object



91
92
93
# File 'lib/origami/string.rb', line 91

def UTF16BE.to_utf16be(str)
  str
end