Module: Pdfrb::Model::Cos::TextString
- Defined in:
- lib/pdfrb/model/cos/text_string.rb
Overview
Semantic accessors for spec-defined text strings (s7.9.2.2). On the wire these are UTF-16BE+BOM or PDFDocEncoding bytes — and read-side decryption hands them back as raw bytes — so every accessor that means "this field is text" decodes via this seam instead of relabelling the encoding. The Model itself stays lossless: only semantic accessors decode.
Class Method Summary collapse
-
.decode(raw) ⇒ String
The decoded UTF-8 text, or
rawunchanged when it is not a String (names, arrays, dates pass through untouched).
Class Method Details
.decode(raw) ⇒ String
Returns the decoded UTF-8 text, or raw unchanged
when it is not a String (names, arrays, dates pass
through untouched).
18 19 20 21 22 |
# File 'lib/pdfrb/model/cos/text_string.rb', line 18 def decode(raw) return raw unless raw.is_a?(::String) StringEncoding.decode_text(raw) end |