Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf16_to8: Convert to preferred utf8_to_uv_flags() #22840

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -3438,15 +3438,10 @@ Perl_utf8_to_utf16_base(pTHX_ U8* s, U8* d, Size_t bytelen, Size_t *newlen,

while (s < send) {
STRLEN retlen;
UV uv = utf8n_to_uvchr(s, send - s, &retlen,
/* No surrogates nor above-Unicode */
UTF8_DISALLOW_ILLEGAL_C9_INTERCHANGE);

/* The modern method is to keep going with malformed input,
* substituting the REPLACEMENT CHARACTER */
if (UNLIKELY(uv == 0 && *s != '\0')) {
uv = UNICODE_REPLACEMENT;
}
UV uv;
utf8_to_uv_flags(s, send, &uv, &retlen,
/* No surrogates nor above-Unicode */
UTF8_DISALLOW_ILLEGAL_C9_INTERCHANGE);

if (uv >= FIRST_IN_PLANE1) { /* Requires a surrogate pair */

Expand Down
Loading