summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-12-16 02:45:06 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-12-16 02:45:06 +0000
commit9466bab696bbe701541ead3a883c2387f5110da2 (patch)
tree070a0fde8d3f0dcf9fbcc1b789f7e4ee2c1ce265 /utf8.c
parent76ccdbe266e63a2a3ac21a782e44a6b13093ac7f (diff)
downloadperl-9466bab696bbe701541ead3a883c2387f5110da2.tar.gz
Make creating UTF-8 surrogates a punishable act.
p4raw-id: //depot/perl@13707
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/utf8.c b/utf8.c
index 75226ca0ee..f21b13c4fe 100644
--- a/utf8.c
+++ b/utf8.c
@@ -68,6 +68,8 @@ Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv)
return d;
}
if (uv < 0x10000) {
+ if (UNICODE_IS_SURROGATE(uv))
+ Perl_croak(aTHX_ "UTF-16 surrogate 0x%04"UVxf, uv);
*d++ = (( uv >> 12) | 0xe0);
*d++ = (((uv >> 6) & 0x3f) | 0x80);
*d++ = (( uv & 0x3f) | 0x80);