Search code examples
pythonmysqlpython-3.xsuperscript

Superscript from database converted to \u00b2


I have a field in mysql which stores the value as "Gold Area (<90 g/m²)". I wrote a code to get the same using python code. However when I return the data the value is converted to "Gold Area (<90 g/m\u00b2)".

I understand we can use the subscript utility while printing. But here my requirement is to send the value as a json response. How can i change the code to not convert the Superscript to \u00b2 and keep it is from db which is m²

any help is greatly appreciated.


Solution

  • if you are using flask then you might look at an option JSON_AS_ASCII = False in the configuration