def convert_string(item)
      CGI.escapeHTML(item).
      
      
      # convert -- to em-dash, (-- to en-dash)
        gsub(/---?/, '&#8212;'). #gsub(/--/, '&#8211;').

      # convert ... to elipsis (and make sure .... becomes .<elipsis>)
        gsub(/\.\.\.\./, '.&#8230;').gsub(/\.\.\./, '&#8230;').

      # convert single closing quote
        gsub(%r{([^ \t\r\n\[\{\(])\'}) { "#$1&#8217;" }.
        gsub(%r{\'(?=\W|s\b)}) { "&#8217;" }.

      # convert single opening quote
        gsub(/'/, '&#8216;').

      # convert double closing quote
        gsub(%r{([^ \t\r\n\[\{\(])\'(?=\W)}) { "#$1&#8221;" }.

      # convert double opening quote
        gsub(/'/, '&#8220;').

      # convert copyright
        gsub(/\(c\)/, '&#169;').

      # convert and registered trademark
        gsub(/\(r\)/, '&#174;')

    end
def convert_string(item)
      CGI.escapeHTML(item).
      
      
      # convert -- to em-dash, (-- to en-dash)
        gsub(/---?/, '&#8212;'). #gsub(/--/, '&#8211;').

      # convert ... to elipsis (and make sure .... becomes .<elipsis>)
        gsub(/\.\.\.\./, '.&#8230;').gsub(/\.\.\./, '&#8230;').

      # convert single closing quote
        gsub(%r{([^ \t\r\n\[\{\(])\'}) { "#$1&#8217;" }.
        gsub(%r{\'(?=\W|s\b)}) { "&#8217;" }.

      # convert single opening quote
        gsub(/'/, '&#8216;').

      # convert double closing quote
        gsub(%r{([^ \t\r\n\[\{\(])\'(?=\W)}) { "#$1&#8221;" }.

      # convert double opening quote
        gsub(/'/, '&#8220;').

      # convert copyright
        gsub(/\(c\)/, '&#169;').

      # convert and registered trademark
        gsub(/\(r\)/, '&#174;')

    end
some of these patterns are taken from SmartyPants...