Question

I am trying to manipulate some UTF-8 text in pydev eclipse but it doesn't print them properly:

e.g.

 ['217080104288', 'Post from \xd8\xa3\xd8\xb2\xd8\xb1\xd9\x8a        \xd8\xba\xd9\x84\xd8\xaa\xd9\x88\xd9\x85  ', '\xd8\xa3\xd8\xb2\xd8\xb1\xd9\x8a \xd8\xba\xd9\x84\xd8\xaa\xd9\x88\xd9\x85', 'Project Sunlight by Unilever Setelah video pendek ini selesai, anda akan diarahkan untuk menjawab survei dan menghasilkan Rp. 5000 Video mungkin tidak dapat diputar di semua browser. Kami sarankan untuk menggunakan Chrome.'

in notepad++ it displays correctly:

217080104292,"Post from أزري غلتوم  ","أزري غلتوم","Project Sunlight by Unilever Setelah video pendek ini selesai, anda akan diarahkan untuk menjawab survei dan menghasilkan Rp. 5000 Video mungkin tidak dapat diputar di semua browser. Kami sarankan untuk menggunakan Chrome.","facebook.com Discussions","Feb 09, 2014 04:18 AM",0,0,0,0,0,0,0,0,0,0,Neutral

even encode("UTF-8") doesn't display it properly.

Était-ce utile?

La solution

When you print a list, it uses repr on every element of the list to turn it into a string. repr is designed to be extra conservative, it displays Unicode characters that aren't ASCII as escape sequences always. If you want to print the string naturally, print it individually instead of trying to print the list that encloses it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top