0

I get this string from the database: 'Paris, \u00cele-de-France'

In the schema, it is encoded with UTF-8 Unicode. I try encode('utf-8') but it is no help.

  • 1
    That's not UTF8. That's a string with \, u, 0, 0, c, e in it. Someone escaped the string before storing it in the database. You'll have to unescape it – Panagiotis Kanavos Feb 09 '18 at 16:09
  • Are you using python2 or python3? Python versions probably will make a difference here. Also: please provide a bit more information about what exactly you are trying to do! – quant Feb 09 '18 at 16:14
  • @quant the question is clear - the OP has an escaped string and wants to recover the original. *Instead* of storing UTF8 in the database, someone replaced all non-ANSI characters with their escaped unicode values – Panagiotis Kanavos Feb 09 '18 at 16:16
  • BTW the UTF8 form of this string is `Île-de-France`. Like almost all sites, SO uses UTF8 encoding. No escaping or special characters were needed. – Panagiotis Kanavos Feb 09 '18 at 16:18
  • Thank you. I get the answer. Yep, the database is wrong. I am just trying to salvage whatever I can while waiting for the database to be updated. – Cuong Nguyen Feb 09 '18 at 16:29

0 Answers0