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

Defined in:
lib/origami/string.rb

Constant Summary collapse

BOM =
"\xFE\xFF".b

Class Method Summary collapse

Class Method Details

.to_pdfdoc(str) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/origami/string.rb', line 92

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



88
89
90
# File 'lib/origami/string.rb', line 88

def UTF16BE.to_utf16be(str)
    str
end