3 ms·
It would make sense to provide some. Example problem could be that both JavaScript strings and std::string can have '\0' bytes in them. Converting them like in
by tibiapejagala 11y ago
It would make sense to provide some.
Example problem could be that both JavaScript strings and std::string can have '\0' bytes in them. Converting them like in the post would lead to string truncation if a null byte was present somewhere in the middle of a string.
So it should be something like (error checking aside):
v8::String::Utf8Value s(args[0]);
std::string str(*s, s.length());