Logo Search packages:      
Sourcecode: zope-cmfbibliographyat version File versions  Download package

def CMFBibliographyAT::tool::bibliography::BibliographyTool::checkEncoding (   self,
  source 
)

Make sure we have utf encoded text

Definition at line 239 of file bibliography.py.

00239                                    :
        """
        Make sure we have utf encoded text
        """
        mimetypesTool = getToolByName(self, 'mimetypes_registry', None)
        encoding = mimetypesTool and mimetypesTool.guess_encoding(source) \
                   or 'utf-8'
        fallbackEncoding = mimetypesTool and \
                           hasattr (mimetypesTool, 'fallbackEncoding') and \
                           mimetypesTool.fallbackEncoding or 'latin1'
        try:
            source = unicode(source, encoding)
        except UnicodeDecodeError:
            source = unicode(source, fallbackEncoding)
        return source.encode('utf-8')

    def checkFormat(self, source, format, file_name):


Generated by  Doxygen 1.6.0   Back to index