mercurial/pure/charencode.py
changeset 33761 f5fc54e7e467
child 33924 b9101467d88b
equal deleted inserted replaced
33760:cd2aca0808f8 33761:f5fc54e7e467
       
     1 # charencode.py - miscellaneous character encoding
       
     2 #
       
     3 #  Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others
       
     4 #
       
     5 # This software may be used and distributed according to the terms of the
       
     6 # GNU General Public License version 2 or any later version.
       
     7 
       
     8 from __future__ import absolute_import
       
     9 
       
    10 def asciilower(s):
       
    11     '''convert a string to lowercase if ASCII
       
    12 
       
    13     Raises UnicodeDecodeError if non-ASCII characters are found.'''
       
    14     s.decode('ascii')
       
    15     return s.lower()
       
    16 
       
    17 def asciiupper(s):
       
    18     '''convert a string to uppercase if ASCII
       
    19 
       
    20     Raises UnicodeDecodeError if non-ASCII characters are found.'''
       
    21     s.decode('ascii')
       
    22     return s.upper()