Index: src/utf.c ================================================================== --- src/utf.c +++ src/utf.c @@ -10,11 +10,11 @@ ** ************************************************************************* ** This file contains routines used to translate between UTF-8, ** UTF-16, UTF-16BE, and UTF-16LE. ** -** $Id: utf.c,v 1.34 2005/12/15 03:04:11 drh Exp $ +** $Id: utf.c,v 1.35 2005/12/15 22:34:01 drh Exp $ ** ** Notes on UTF-8: ** ** Byte-0 Byte-1 Byte-2 Byte-3 Value ** 0xxxxxxx 00000000 00000000 0xxxxxxx @@ -460,11 +460,13 @@ char *sqlite3utf16to8(const void *z, int nByte){ Mem m; memset(&m, 0, sizeof(m)); sqlite3VdbeMemSetStr(&m, z, nByte, SQLITE_UTF16NATIVE, SQLITE_STATIC); sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8); - return m.z; + assert( m.flags & MEM_Term ); + assert( m.flags & MEM_Str ); + return (m.flags & MEM_Dyn)!=0 ? m.z : sqlite3StrDup(m.z); } /* ** pZ is a UTF-16 encoded unicode string. If nChar is less than zero, ** return the number of bytes up to (but not including), the first pair