Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • get_encodings, ustr and exception_to_unicode were originally from tools.misc in openerp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 162
    Comment on it

    Set encoding to default and find value to get_encodings, ustr and exception_to_unicode were originally from tools.misc in openerp and use this method in openerp. Use this code in .py file in openerp

    ef get_encodings(hint_encoding='utf-8'):
        fallbacks = {
            'latin1': 'latin9',
            'iso-8859-1': 'iso8859-15',
            'cp1252': '1252',
        }
        if hint_encoding:
            yield hint_encoding
            if hint_encoding.lower() in fallbacks:
                yield fallbacks[hint_encoding.lower()]
    
        # some defaults (also taking care of pure ASCII)
        for charset in ['utf8','latin1']:
            if not hint_encoding or (charset.lower() != hint_encoding.lower()):
                yield charset
    
        from locale import getpreferredencoding
        prefenc = getpreferredencoding()
        if prefenc and prefenc.lower() != 'utf-8':
            yield prefenc
            prefenc = fallbacks.get(prefenc.lower())
            if prefenc:
                yield prefenc
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: