# File lib/Dnsruby/resource/TXT.rb, line 52
      def TXT.parse(input)
        # Need to look out for special characters.

        # Need to split the input up into strings (which are defined by non-escaped " characters)

        # Then need to fix up any \ escape characters (should just be " and ; and binary?)

        # Sadly, it's going to be easiest just to scan through this character by character...

        in_escaped = false
        in_string = false
        count = -1
        strings = []
        current_binary = ""
        current_quote_char = '"'
        unquoted = false
        seen_strings = false
        pos = 0
        input.sub!(/^\s*\(\s*/, "")
        input.sub!(/\s*\)\s*$/, "")
        input.each_char {|c|
          if (((c == "'") || (c == '"')) && (!in_escaped) && (!unquoted))
            if (!in_string)
              seen_strings = true
              current_quote_char = c
              in_string = true
              count+=1
              strings[count] = ""
            else
              if (c == current_quote_char)
                in_string = false
              else
                strings[count]+=c
              end
            end
          else
            if (seen_strings && !in_string)
              next
            end
            if (pos == 0)
              unquoted = true
              count+=1
              strings[count] = ""
            elsif (unquoted)
              if (c == " ")
                count+=1
                strings[count] = ""
                pos += 1
                next
              end
            end

            if (c == "\\")
              if (in_escaped)
                in_escaped = false
                strings[count]+=(c)
              else
                in_escaped = true
              end
            else
              if (in_escaped)
                # Build up the binary

                if (c == ";") || (c == '"')
                  strings[count]+=c
                  in_escaped = false
                elsif (ESCAPE_CHARS[c])
                  in_escaped=false
                  strings[count]+=ESCAPE_CHARS[c].chr
                elsif (c<"0" || c>"9")
                  in_escaped = false
                  strings[count]+=c
                else
                  # Must be building up three digit string to identify binary value?

#                  if (c >= "0" && c <= "9")

                    current_binary += c
#                  end

                  if ((current_binary.length == 3) ) # || (c < "0" || c > "9"))

                    strings[count]+=current_binary.to_i.chr
                    in_escaped = false
                    current_binary = ""
                  end
                end
              else
                strings[count]+=(c)
              end
            end
          end
          pos += 1
        }
        return strings
      end