class CFPropertyList::CFString
It will convert the value to UTF-16BE if necessary (i.e. if non-ascii char contained)
This class holds string values, both, UTF-8 and UTF-16BE
def quoted
def quoted str = '"' @value.each_char do |c| str << case c when '"' '\\"' when '\\' '\\' when "\a" "\\a" when "\b" "\\b" when "\f" "\\f" when "\n" "\n" when "\v" "\\v" when "\r" "\\r" when "\t" "\\t" else c end end str << '"' end
def to_binary(bplist)
def to_binary(bplist) bplist.string_to_binary(@value); end
def to_plain(plist)
def to_plain(plist) if @value =~ /^\w+$/ @value else quoted end end
def to_xml(parser)
def to_xml(parser) n = parser.new_node('string') n = parser.append_node(n, parser.new_text(@value)) unless @value.nil? n end