Python _locale.CODESET Examples
The following are 8
code examples of _locale.CODESET().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
_locale
, or try the search function
.
Example #1
Source File: _bootlocale.py From kobo-predict with BSD 2-Clause "Simplified" License | 5 votes |
def getpreferredencoding(do_setlocale=True): assert not do_setlocale result = _locale.nl_langinfo(_locale.CODESET) if not result and sys.platform == 'darwin': # nl_langinfo can return an empty string # when the setting has an invalid value. # Default to UTF-8 in that case because # UTF-8 is the default charset on OSX and # returning nothing will crash the # interpreter. result = 'UTF-8' return result
Example #2
Source File: _bootlocale.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def getpreferredencoding(do_setlocale=True): assert not do_setlocale if sys.flags.utf8_mode: return 'UTF-8' result = _locale.nl_langinfo(_locale.CODESET) if not result and sys.platform == 'darwin': # nl_langinfo can return an empty string # when the setting has an invalid value. # Default to UTF-8 in that case because # UTF-8 is the default charset on OSX and # returning nothing will crash the # interpreter. result = 'UTF-8' return result
Example #3
Source File: _bootlocale.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def getpreferredencoding(do_setlocale=True): assert not do_setlocale result = _locale.nl_langinfo(_locale.CODESET) if not result and sys.platform == 'darwin': # nl_langinfo can return an empty string # when the setting has an invalid value. # Default to UTF-8 in that case because # UTF-8 is the default charset on OSX and # returning nothing will crash the # interpreter. result = 'UTF-8' return result
Example #4
Source File: _bootlocale.py From Imogen with MIT License | 5 votes |
def getpreferredencoding(do_setlocale=True): assert not do_setlocale if sys.flags.utf8_mode: return 'UTF-8' result = _locale.nl_langinfo(_locale.CODESET) if not result and sys.platform == 'darwin': # nl_langinfo can return an empty string # when the setting has an invalid value. # Default to UTF-8 in that case because # UTF-8 is the default charset on OSX and # returning nothing will crash the # interpreter. result = 'UTF-8' return result
Example #5
Source File: _bootlocale.py From scylla with Apache License 2.0 | 5 votes |
def getpreferredencoding(do_setlocale=True): assert not do_setlocale result = _locale.nl_langinfo(_locale.CODESET) if not result and sys.platform == 'darwin': # nl_langinfo can return an empty string # when the setting has an invalid value. # Default to UTF-8 in that case because # UTF-8 is the default charset on OSX and # returning nothing will crash the # interpreter. result = 'UTF-8' return result
Example #6
Source File: _bootlocale.py From ironpython3 with Apache License 2.0 | 5 votes |
def getpreferredencoding(do_setlocale=True): assert not do_setlocale result = _locale.nl_langinfo(_locale.CODESET) if not result and sys.platform == 'darwin': # nl_langinfo can return an empty string # when the setting has an invalid value. # Default to UTF-8 in that case because # UTF-8 is the default charset on OSX and # returning nothing will crash the # interpreter. result = 'UTF-8' return result
Example #7
Source File: _bootlocale.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def getpreferredencoding(do_setlocale=True): assert not do_setlocale result = _locale.nl_langinfo(_locale.CODESET) if not result and sys.platform == 'darwin': # nl_langinfo can return an empty string # when the setting has an invalid value. # Default to UTF-8 in that case because # UTF-8 is the default charset on OSX and # returning nothing will crash the # interpreter. result = 'UTF-8' return result
Example #8
Source File: _bootlocale.py From android_universal with MIT License | 5 votes |
def getpreferredencoding(do_setlocale=True): assert not do_setlocale if sys.flags.utf8_mode: return 'UTF-8' result = _locale.nl_langinfo(_locale.CODESET) if not result and sys.platform == 'darwin': # nl_langinfo can return an empty string # when the setting has an invalid value. # Default to UTF-8 in that case because # UTF-8 is the default charset on OSX and # returning nothing will crash the # interpreter. result = 'UTF-8' return result