You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the current header for convert_latin1_to_utf8 only accepts one length value for the latin1 input, and it is assumed that char* utf8_output has sufficient length to hold all the data.
/** * Convert Latin1 string into UTF8 string. * * This function is suitable to work with inputs from untrusted sources. * * @param input the Latin1 string to convert * @param length the length of the string in bytes * @param latin1_output the pointer to buffer that can hold conversion result * @return the number of written char; 0 if conversion is not possible*/
simdutf_warn_unused virtualsize_tconvert_latin1_to_utf8(constchar * input, size_t length, char* utf8_output) constnoexcept = 0;
Since 1 latin1 character can potentially become 2 utf8 bytes, the two lengths cannot be precisely the same unless the input is all ascii.
It'd be straightforward for the user of simdutf to add an extra pass to compute the length, but wouldn't that would that usually be slower than checking if there's enough length after each non-ascii character is written?
The text was updated successfully, but these errors were encountered:
the current header for
convert_latin1_to_utf8
only accepts onelength
value for the latin1 input, and it is assumed thatchar* utf8_output
has sufficient length to hold all the data.Since 1 latin1 character can potentially become 2 utf8 bytes, the two lengths cannot be precisely the same unless the input is all ascii.
It'd be straightforward for the user of simdutf to add an extra pass to compute the length, but wouldn't that would that usually be slower than checking if there's enough length after each non-ascii character is written?
The text was updated successfully, but these errors were encountered: