void ViewFieldUnicodeTransformer::transform(unsigned & lenTarget, char * & target, unsigned lenSource, const char * source) { unsigned lenUnicodeSrc; unsigned lenUnicodeTarget; rtlDataAttr unicodeSrc; rtlDataAttr unicodeTarget; rtlUtf8ToUnicodeX(lenUnicodeSrc, unicodeSrc.refustr(), lenSource, source); (*function)(lenUnicodeTarget, unicodeTarget.refustr(), lenUnicodeSrc, unicodeSrc.getustr()); rtlUnicodeToUtf8X(lenTarget, target, lenUnicodeTarget, unicodeTarget.getustr()); }
void CouchbaseEmbedFunctionContext::getUnicodeResult(size32_t &chars, UChar * &result) { auto value = nextResultScalar(); if (value && *value) { unsigned numchars = rtlUtf8Length(strlen(value), value); rtlUtf8ToUnicodeX(chars, result, numchars, value); } NullFieldProcessor p(NULL); rtlUnicodeToUnicodeX(chars, result, p.resultChars, p.unicodeResult); }
void CouchbaseRowBuilder::getUnicodeResult(const RtlFieldInfo *field, size32_t &chars, UChar * &result) { const char * value = nextField(field); if (!value || !*value) { NullFieldProcessor p(field); rtlUnicodeToUnicodeX(chars, result, p.resultChars, p.unicodeResult); return; } unsigned numchars = rtlUtf8Length(strlen(value), value); // MORE - is it a good assumption that it is utf8 ? Depends how the database is configured I think rtlUtf8ToUnicodeX(chars, result, numchars, value); return; }
static void getUnicodeResult(const RtlFieldInfo *field, const MYSQL_BIND &bound, size32_t &chars, UChar * &result) { if (*bound.is_null) { NullFieldProcessor p(field); rtlUnicodeToUnicodeX(chars, result, p.resultChars, p.unicodeResult); return; } if (bound.buffer_type != MYSQL_TYPE_STRING && bound.buffer_type != MYSQL_TYPE_VAR_STRING) typeError("string", field); const char *text = (const char *) bound.buffer; unsigned long bytes = *bound.length; unsigned numchars = rtlUtf8Length(bytes, text); // MORE - is it a good assumption that it is utf8 ? Depends how the database is configured I think rtlUtf8ToUnicodeX(chars, result, numchars, text); }