parameters: (self, text)
return_statement: return res
docstring: Recodes the given text from the old character set to utf-8
docstring_summary: Recodes the given text from the old character set to utf-8
docstring_tokens: Recodes the given text from the old character set to utf - 8
function: def _enc(self, text):
          """Recodes the given text from the old character set to utf-8"""
          res = text
          out_charset = self.out_charset or self.inp_charset
          if isinstance(text, unicode):
              res = text.encode(out_charset or 'utf8')
          elif isinstance(text, str) and out_charset:
              try:
                  res = unicode(text, encoding=self.inp_charset).encode(
                      out_charset)
              except (UnicodeEncodeError, UnicodeDecodeError):
                  LOG.error("_enc: charset %s is not working for %s",
                      self.inp_charset, text)
                  res = unicode(text, encoding=self.inp_charset,
                      errors='replace').encode(out_charset)
          elif isinstance(text, (list, tuple)):
              res = type(text)(map(self._enc, text))
          return res
function_tokens: def _enc ( self , text ) : res = text out_charset = self . out_charset or self . inp_charset if isinstance ( text , unicode ) : res = text . encode ( out_charset or 'utf8' ) elif isinstance ( text , str ) and out_charset : try : res = unicode ( text , encoding = self . inp_charset ) . encode ( out_charset ) except ( UnicodeEncodeError , UnicodeDecodeError ) : LOG . error ( "_enc: charset %s is not working for %s" , self . inp_charset , text ) res = unicode ( text , encoding = self . inp_charset , errors = 'replace' ) . encode ( out_charset ) elif isinstance ( text , ( list , tuple ) ) : res = type ( text ) ( map ( self . _enc , text ) ) return res