VirtualMailManager/__init__.py
changeset 152 3dbee02711cd
parent 141 ecd6a379e523
child 162 0ac9ef587769
equal deleted inserted replaced
151:350488efe67d 152:3dbee02711cd
     9 import locale
     9 import locale
    10 
    10 
    11 from constants.VERSION import *
    11 from constants.VERSION import *
    12 import constants.ERROR as ERR
    12 import constants.ERROR as ERR
    13 
    13 
    14 # Set all of the locales according to the current environment variables
    14 # Try to set all of the locales according to the current
    15 # and get the character encoding.
    15 # environment variables and get the character encoding.
    16 locale.setlocale(locale.LC_ALL, '')
    16 try:
       
    17     locale.setlocale(locale.LC_ALL, '')
       
    18 except locale.Error:
       
    19     locale.setlocale(locale.LC_ALL, 'C')
    17 ENCODING = locale.nl_langinfo(locale.CODESET)
    20 ENCODING = locale.nl_langinfo(locale.CODESET)
    18 
    21 
    19 def w_std(*args):
    22 def w_std(*args):
    20     """Writes each arg of args, encoded in the current ENCODING, to stdout and
    23     """Writes each arg of args, encoded in the current ENCODING, to stdout and
    21     appends a newline."""
    24     appends a newline."""