diff options
author | drh <drh@noemail.net> | 2013-03-01 15:02:52 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-03-01 15:02:52 +0000 |
commit | de977248271dd1f41ab95c63b60e4b838ba8ebef (patch) | |
tree | d1eb642acb3bc0ca0ca228a78418d7a44fae1908 /src/func.c | |
parent | 503a686e09ce03995eef5d9a95ef217532575be5 (diff) | |
download | sqlite-de977248271dd1f41ab95c63b60e4b838ba8ebef.tar.gz sqlite-de977248271dd1f41ab95c63b60e4b838ba8ebef.zip |
Fix the handling of UTF16 surrogate pairs in the char() function.
FossilOrigin-Name: ff67d87894eeb0036374235c5723e267536909f9
Diffstat (limited to 'src/func.c')
-rw-r--r-- | src/func.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/func.c b/src/func.c index 43a338ed3..09453b3c6 100644 --- a/src/func.c +++ b/src/func.c @@ -999,10 +999,10 @@ static void charFunc( if( x<0 || x>0x10ffff ) x = 0xfffd; c = (unsigned)(x & 0x1fffff); if( c<=0xFFFF ){ + if( c>=0xd800 && c<=0xdfff ) c = 0xfffd; *zOut++ = (u8)(c&0x00FF); *zOut++ = (u8)((c>>8)&0x00FF); }else{ - if( c>=0xd800 && c<=0xdbff ) c = 0xfffd; *zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0)); *zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03)); *zOut++ = (u8)(c&0x00FF); |