GoGoWen opened a new pull request, #21390:
URL: https://github.com/apache/doris/pull/21390

   ## Proposed changes
   
   Issue Number: close #21389
   
   from rapidjson:
   
   Query String
   In addition to GetString(), the Value class also contains GetStringLength(). 
Here explains why:
   
   According to RFC 4627, JSON strings can contain Unicode character U+0000, 
which must be escaped as "\u0000". The problem is that, C/C++ often uses 
null-terminated string, which treats \0 as the terminator symbol.
   
   To conform with RFC 4627, RapidJSON supports string containing U+0000 
character. If you need to handle this, you can use GetStringLength() to obtain 
the correct string length.
   
   For example, after parsing the following JSON to Document d:
   
   { "s" :  "a\u0000b" }
   The correct length of the string "a\u0000b" is 3, as returned by 
GetStringLength(). But strlen() returns 1.
   
   GetStringLength() can also improve performance, as user may often need to 
call strlen() for allocating buffer.
   
   Besides, std::string also support a constructor:
   
   string(const char* s, size_t count);
   which accepts the length of string as parameter. This constructor supports 
storing null character within the string, and should also provide better 
performance.
   
   
   
   <!--Describe your changes.-->
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at 
[[email protected]](mailto:[email protected]) by explaining why you 
chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to