Method: PSD::File#read_unicode_string

Defined in:
lib/psd/file.rb

#read_unicode_string(length = nil) ⇒ Object

Reads a unicode string, which is double the length of a normal string and encoded as UTF-16.



83
84
85
86
87
88
89
# File 'lib/psd/file.rb', line 83

def read_unicode_string(length=nil)
  length ||= read_int if length.nil?
  return '' if length.nil? || length <= 0
  read(length * 2)
    .encode('UTF-8', 'UTF-16BE', universal_newline: true)
    .delete("\000")
end