- unicode_encoding &= ~SL_ENC_UTF_16;
- EC_NEG1( convert_string_allocate(CH_UCS2, CH_UTF8, buf + offset + (mark_exists ? 18 : 16), slen, &p) );
+ if (unicode_encoding & SL_ENC_BIG_ENDIAN)
+ EC_FAIL_LOG("Unsupported big endian UTF16 string");
+ slen -= mark_exists ? 2 : 0;
+ EC_NEG1( convert_string_allocate(CH_UCS2,
+ CH_UTF8,
+ buf + offset + (mark_exists ? 10 : 8),
+ slen,
+ &tmp) );
+ p = dalloc_strndup(query, tmp, strlen(tmp));
+ free(tmp);