def __init__(self, handler, charset=None, debug=0):
   SGMLParser3.__init__(self)
   self.debug = debug
   self.handler = handler
   self.linepos = 0
   self.decoder = getdecoder(charset or 'iso-8859-1')
   self.charset = charset
   self.tagstack = []
   if self.debug:
     print >>stderr, 'HTMLParser3: start'
   return
 def set_charset(self, charset):
   '''Changes the current charset and codec.'''
   if self.charset: return
   try:
     self.decoder = getdecoder(charset)
   except LookupError:
     return
   self.charset = charset
   self.handler.set_charset(charset)
   if self.debug:
     print >>stderr, 'set_charset: %s' % charset
   return