diff options
author | Karl Williamson <khw@cpan.org> | 2016-10-10 21:18:37 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-10-13 11:18:12 -0600 |
commit | f9380377ac81dfbd87f997094a742406eb899a15 (patch) | |
tree | 399236fb4d72c139a7c90e44fc309795ee41ad93 /utf8.h | |
parent | 3757e55dd9611aede000f6f036237c4fda19b4f6 (diff) | |
download | perl-f9380377ac81dfbd87f997094a742406eb899a15.tar.gz |
Add utf8n_to_uvchr_error
This new function behaves like utf8n_to_uvchr(), but takes an extra
parameter that points to a U32 which will be set to 0 if no errors are
found; otherwise each error found will set a bit in it. This can be
used by the caller to figure out precisely what the error(s) is/are.
Previously, one would have to capture and parse the warning/error
messages raised. This can be used, for example, to customize the
messages to the expected end-user's knowledge level.
Diffstat (limited to 'utf8.h')
-rw-r--r-- | utf8.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -72,6 +72,8 @@ the string is invariant. #define utf8_to_uvchr_buf(s, e, lenp) \ utf8n_to_uvchr(s, (U8*)(e) - (U8*)(s), lenp, \ ckWARN_d(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY) +#define utf8n_to_uvchr(s, len, lenp, flags) \ + utf8n_to_uvchr_error(s, len, lenp, flags, 0) #define to_uni_fold(c, p, lenp) _to_uni_fold_flags(c, p, lenp, FOLD_FLAGS_FULL) #define to_utf8_fold(c, p, lenp) _to_utf8_fold_flags(c, p, lenp, FOLD_FLAGS_FULL) |