You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "xiaokang (via GitHub)" <gi...@apache.org> on 2023/04/13 03:29:55 UTC

[GitHub] [doris] xiaokang commented on a diff in pull request #18585: [Improve](simdjson reader) support UTF-8 unicode (with BOM)

xiaokang commented on code in PR #18585:
URL: https://github.com/apache/doris/pull/18585#discussion_r1164946357


##########
be/src/vec/exec/format/json/new_json_reader.cpp:
##########
@@ -1549,6 +1552,13 @@ Status NewJsonReader::_simdjson_parse_json_doc(size_t* size, bool* eof) {
         _simdjson_ondemand_padding_buffer.resize(*size + simdjson::SIMDJSON_PADDING);
         _padded_size = *size + simdjson::SIMDJSON_PADDING;
     }
+    // trim BOM since simdjson does not handle UTF-8 Unicode (with BOM)
+    if (*size >= 3 && static_cast<char>(json_str[0]) == '\xEF' &&

Review Comment:
   There are some more cases for BOM.
   
   https://learn.microsoft.com/en-us/globalization/encoding/byte-order-mark
   https://www.cnblogs.com/qinmengjiao123-123/p/8325646.html



-- 
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@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org