You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/02/09 13:38:39 UTC

[GitHub] [airflow] ashb commented on a change in pull request #21460: Add non-ascii character support in xcom table

ashb commented on a change in pull request #21460:
URL: https://github.com/apache/airflow/pull/21460#discussion_r802669323



##########
File path: tests/models/test_xcom.py
##########
@@ -377,6 +377,30 @@ def test_xcom_get_many_from_prior_dates_with_execution_date(
         assert [x.execution_date for x in stored_xcoms] == [dr2.logical_date, dr1.logical_date]
 
 
+class TestXComSerializeNonAsciiValue:
+    @conf_vars({("core", "enable_xcom_pickling"): "false"})
+    def test_serialize_disable_pickling(self, session, dag_run):
+        val = XCom.serialize_value(['前有大梅林'])
+        assert val == b'["\xe5\x89\x8d\xe6\x9c\x89\xe5\xa4\xa7\xe6\xa2\x85\xe6\x9e\x97"]'

Review comment:
       This does not look like the correct JSONification of the characters.
   
   The default `json.dumps)` uses `\uDDDD` sequences and roundtrips fine:
   
   ```
   In [8]: json.dumps(x).encode("UTF-8")
   Out[8]: b'["\\u524d\\u6709\\u5927\\u6885\\u6797"]'
   
   In [9]: json.loads(_8)
   Out[9]: ['前有大梅林']
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org