0

Hi All I am getting following error while loading JSON String from Snowflake Python Connector to Snowflake "Invalid unicode escape sequence '\u8def6515'; should be at most '\u0010FFFF'"

I am connecting to 3rd Part API andusing httprequest object in Python and returned result coming into JSON contains some unicode characters like "\u5927\u6c5f\u4e1c\u4ea7\u4e1a\u96c6\u805a\u533a\u6c5f\u4e1c\u4e09\u8def6515\u53f7"

While trying to load this JSON string into Snowflake Table with Variant Column using Snowflake Python Connector , i am getting following error.

"Invalid unicode escape sequence '\u8def6515'; should be at most '\u0010FFFF'."

How do i handle INSERT INTO TABLE WITH VARIANT COLUMN with these sequence of unicodes in strings

  • 1
    Why does that API use escape sequences instead of characters? That's the real bug. Python 3 strings *are* Unicode, they don't need any escape sequences to represent non-English characters. This page is Unicode. JSON is just text and since all HTTP APIs return UTF8, it's Unicode as well. – Panagiotis Kanavos Apr 12 '21 at 08:26
  • What is the *actual* JSON string? Where did you see these escape sequences? Are you sure this isn't how the Python console displays a UTF8 string? The escape sequences you posted represent Chinese characters and *don't require escaping*. `\u8def6515` on the other hand looks like two escape sequences with a missing intermediate `\u`. – Panagiotis Kanavos Apr 12 '21 at 08:31
  • Check [JSON and Escaping Charactters](https://stackoverflow.com/questions/4901133/json-and-escaping-characters). Only control characters need to be escaped. – Panagiotis Kanavos Apr 12 '21 at 08:35

0 Answers0