~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Martin Packman
  • Date: 2012-01-05 10:37:58 UTC
  • mto: This revision was merged to the branch mainline in revision 6427.
  • Revision ID: martin.packman@canonical.com-20120105103758-wzftnmsip5iv9n2g
Revert addition of get_message_encoding function

Show diffs side-by-side

added added

removed removed

Lines of Context:
2035
2035
    return get_terminal_encoding()
2036
2036
 
2037
2037
 
2038
 
_message_encoding = None
2039
 
 
2040
 
 
2041
 
def get_message_encoding():
2042
 
    """Return the encoding used for messages
2043
 
 
2044
 
    While the message encoding is a general setting it should usually only be
2045
 
    needed for decoding system error strings such as from OSError instances.
2046
 
    """
2047
 
    global _message_encoding
2048
 
    if _message_encoding is None:
2049
 
        if os.name == "posix":
2050
 
            # This is a process-global setting that can change, but should in
2051
 
            # general just get set once at process startup then be constant.
2052
 
            _message_encoding = locale.getlocale(locale.LC_MESSAGES)[1]
2053
 
        else:
2054
 
            # On windows want the result of GetACP() which this boils down to.
2055
 
            _message_encoding = get_user_encoding()
2056
 
    return _message_encoding or "ascii"
2057
 
        
2058
 
 
2059
2038
def get_host_name():
2060
2039
    """Return the current unicode host name.
2061
2040