horaedb
horaedb copied to clipboard
edit: datum struct string type added utf8 check
Rationale
Close #1300
Detailed Changes
Check whether it is a utf8 string when inserting data
Test Plan
pass
I forgot, I'll try adding a few more unit tests later
I checked the rust official documentation, and for the way to build Datum objects from String in datum.rs, rust guarantees that String is a utf8 string, which I might need to modify elsewhere. 😢
rust guarantees that String is a utf8 string, which I might need to modify elsewhere. 😢
Yes, I grep the code and find several place contains from_bytes_unchecked(bytes: Bytes).
As for debugging this issue, you can construct a GBK string using SDK, and trace why there is no error for it.
rust guarantees that String is a utf8 string, which I might need to modify elsewhere. 😢
Yes, I grep the code and find several place contains
from_bytes_unchecked(bytes: Bytes).As for debugging this issue, you can construct a GBK string using SDK, and trace why there is no error for it.
Ok, I'll try
The from_bytes_unchecked function will only be called when decoding. I think what I should be looking for is why non-UTF8 characters are saved when encoding. I'll find out later😵