Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert encoded unicode to readable unicode [duplicate]

I'm so lost on this topic that I don't even know how to properly phrase my question.

I have a bunch of weird escape delimited codes within unicode in python. I want to make it human readable. I believe that it must be once again be in unicode format because there are characters unrepresentable in ascii. How can I do this? There are simply too many things online like encode, decode, str, codec, etc etc that i'm not sure what to do anymore.

Thank you.

u"\u202e\u062c\u0647\u0627\u0646\u202c - \u202dBBC     
\u202e\u0641\u0627\u0631\u0633\u06cc\u202c - 
\u202e\u0646\u0634\u0633\u062a '\u062f"
like image 571
Lucas Ou-Yang Avatar asked Feb 24 '26 02:02

Lucas Ou-Yang


1 Answers

I believe you've got your hands on some Persian!

>>> foo = u"\u202e\u062c\u0647\u0627\u0646\u202c - \u202dBBC  \u202e\u0641\u0627\u0631\u0633\u06cc\u202c - \u202e\u0646\u0634\u0633\u062a
>>> print foo        
جهان‬ - ‭BBC  ‮فارسی‬ - ‮نشست 'د       

Stackoverflow's codeblock feature doesn't seem to like a combination of left-/right-aligned text very well, so here's a screenshot aswell:

Persian unicode output

It seems to be something about BBC World Persian (Iran). Atleast that's what Google translate indicates. It is horribly hard to get the order right because of broken selection, but the language seems to fit.

like image 124
timss Avatar answered Feb 25 '26 15:02

timss



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!