[Python] Decode from Escaped Unicode to Arabic using Python

Discussão em 'Python' iniciado por Stack, Maio 8, 2025.

  1. Stack

    Stack Membro Participativo

    I was trying to decode a json file that has escaped unicode text /uHHH .. the original text is Arabic

    my research lead me to the following code using python.

    s = '\u00d8\u00b5\u00d9\u0088\u00d8\u00b1 \u00d8\u00a7\u00d9\u0084\u00d9\u008a\u00d9\u0088\u00d9\u0085\u00d9\u008a\u00d8\u00a7\u00d8\u00aa'
    ouy= s.encode('utf-8').decode('unicode-escape').encode('latin1').decode('utf-8')
    print(ouy)


    the result text will be: ØµÙØ± اÙÙÙÙÙØ§Øª which still needs some fix using online tool to become the original text: صور اليوميات

    Is there any way to perform that fix using the above code? Would appreciate your help guys, thanks in advance

    Continue reading...

Compartilhe esta Página