def unescape_string_literal(literal, encoding):
if encoding is None:<EOL><INDENT>encoding = getfilesystemencoding()<EOL><DEDENT>if literal[<NUM_LIT:0>] in '<STR_LIT>':<EOL><INDENT>return literalize_string(<EOL>literal[<NUM_LIT:2>:-<NUM_LIT:1>].decode('<STR_LIT>').encode(encoding),<EOL>is_unicode=True<EOL>)<EOL><DEDENT>else:<EOL><INDENT>content = literal[<NUM_LIT:1>:-<NUM_LIT:1>].decode('<STR_LIT>')<EOL>try:<EOL><INDENT>content.decode(encoding)<EOL><DEDENT>except UnicodeDecodeError:<EOL><INDENT>return literal<EOL><DEDENT><DEDENT>return literalize_string(content)<EOL>
r'''Unescape a string or unicode literal.

    Examples:

    >>> u = u'\u4e16\u754c\u4f60\u597d' # 世界你好
    >>> print unescape_string_literal(repr(u), 'utf-8')
    u'世界你好'

    >>> print unescape_string_literal(repr(u.encode('utf-8')), 'utf-8')
    '世界你好'

    >>> print unescape_string_literal(repr(u.encode('big5')), 'utf-8')
    '\xa5@\xac\xc9\xa7A\xa6n'