diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-07 06:26:30 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-07 06:26:30 +0000 |
commit | 3c77ea2bace63b1ad27d15a6366cb938bdd158cb (patch) | |
tree | 4f7833e63f5047ba704288bc8311e27b7a7481f0 /utf8.c | |
parent | 7fa2f4f15785dd46abca32ba3f3cb3aabf0263dd (diff) | |
download | perl-3c77ea2bace63b1ad27d15a6366cb938bdd158cb.tar.gz |
allow 64-bit utf8-encoded integers (from Ilya Zakharevich)
p4raw-id: //depot/perl@5011
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -84,6 +84,11 @@ Perl_uv_to_utf8(pTHX_ U8 *d, UV uv) #ifdef HAS_QUAD { *d++ = 0xff; /* Can't match U+FFFE! */ + *d++ = 0x80; /* 6 Reserved bits */ + *d++ = (((uv >> 60) & 0x0f) | 0x80); /* 2 Reserved bits */ + *d++ = (((uv >> 54) & 0x3f) | 0x80); + *d++ = (((uv >> 48) & 0x3f) | 0x80); + *d++ = (((uv >> 42) & 0x3f) | 0x80); *d++ = (((uv >> 36) & 0x3f) | 0x80); *d++ = (((uv >> 30) & 0x3f) | 0x80); *d++ = (((uv >> 24) & 0x3f) | 0x80); @@ -120,8 +125,8 @@ Perl_utf8_to_uv(pTHX_ U8* s, I32* retlen) else if (!(uv & 0x08)) { len = 4; uv &= 0x07; } else if (!(uv & 0x04)) { len = 5; uv &= 0x03; } else if (!(uv & 0x02)) { len = 6; uv &= 0x01; } - else if (!(uv & 0x01)) { len = 7; uv &= 0x00; } - else len = 8; /* whoa! */ + else if (!(uv & 0x01)) { len = 7; uv = 0; } + else { len = 13; uv = 0; } /* whoa! */ if (retlen) *retlen = len; |