def encode_str(s):
    try:
        s = s.encode('utf-8')
    except __HOLE__:
        s = s.decode('iso-8859-1').encode('utf-8')
    return s
dataset/ETHPy150Open gwu-libraries/launchpad/lp/ui/templatetags/launchpad_extras.py/encode_str