Commits

Frank Smit committed 20d5509

Properly decode a byte string.

  • Participants
  • Parent commits 6cf8d86

Comments (0)

Files changed (1)

     if encoding is None:
         encoding = detect_encoding(po_object)
 
+    parser = _POFileParser(po_object, encoding, check_for_duplicates, klass)
+
 
 
 def _pofile(pofile, **kwargs):
             break
 
     try:
-        charset = str(match.group(1).strip())
+        charset = match.group(1).strip()
+        if hasattr(charset, 'decode'):
+            charset = charset.decode('utf-8')
+
         codecs.lookup(charset)
     except LookupError:
         charset = default_encoding
             file (optional, default: ``False``).
         """
         enc = kwargs.get('encoding', default_encoding)
+
+        # TODO: Detect file object type (actual file, string, file-like)
         if os.path.exists(pofile):
             try:
                 self.fhandle = codecs.open(pofile, 'rU', enc)