def strip_tags
      tags_length = 0
      @tags = Hash.new('')

      @stripped_text = text.gsub(ENTITIES_AND_TAGS_PATTERN) do |tag|
        pos = $`.length - tags_length
        tags_length += tag.length
        @tags[pos] += tag

        # Entities need to have a non-printing character that can represent them.
        # Still not right, but does mean there are the right number of characters.
        if tag[0] == '&'
          tags_length -= 1
          ENTITY_PLACEHOLDER # Will be expanded later.
        else
          '' # Tags don't use up space, so ignore them.
        end
      end
    end
def strip_tags
      tags_length = 0
      @tags = Hash.new('')

      @stripped_text = text.gsub(ENTITIES_AND_TAGS_PATTERN) do |tag|
        pos = $`.length - tags_length
        tags_length += tag.length
        @tags[pos] += tag

        # Entities need to have a non-printing character that can represent them.
        # Still not right, but does mean there are the right number of characters.
        if tag[0] == '&'
          tags_length -= 1
          ENTITY_PLACEHOLDER # Will be expanded later.
        else
          '' # Tags don't use up space, so ignore them.
        end
      end
    end
Strip XML tags and entities ("<c=000000></c>" and "&entity;")
 @note Entities will mess up the system because we don't know how wide they are.