[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Please check if this small code snippet looks correct
As I'm new to all this, I want to make sure this is the right way to
create a scalar value containing a single arbitrary unicode codepoint,
in utf8. uv is a UV containing the ordinal value to store.
U8 string[UTF8_MAXBYTES+1];
U8 *tmps;
SV *sv_str;
tmps = uvuni_to_utf8(string, uv);
sv_str = newSVpvn_utf8((char*)string, tmps - string, TRUE);
I believe this works even if the code point is NUL.
thanks
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]