Module Origami::String
In: sources/parser/string.rb

Module common to String objects.

Methods

new   real_type   to_utf8  

Included Modules

Origami::Object

Classes and Modules

Module Origami::String::Encoding

Attributes

encoding  [RW] 

Public Class methods

[Source]

     # File sources/parser/string.rb, line 99
 99:     def initialize(str)
100:       
101:       @encoding = 
102:       if str[0,2] == Encoding::UTF16BE::MAGIC
103:         Encoding::UTF16BE
104:       else
105:         Encoding::PDFDocEncoding
106:       end
107: 
108:       super(str)
109:     end

Public Instance methods

[Source]

    # File sources/parser/string.rb, line 97
97:     def real_type ; Origami::String end

[Source]

     # File sources/parser/string.rb, line 111
111:     def to_utf8
112:       require 'iconv'
113: 
114:       i = Iconv.new("UTF-8", "UTF16")
115:         utf16str = i.iconv(self.encoding.to_utf16be(self.value))
116:       i.close
117: 
118:       utf16str
119:     end

[Validate]