8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 10:43:03 +01:00

Fixed CORE-4136 - Sharp-S character treated incorrectly in UNICODE_CI_AI collation.

This commit is contained in:
asfernandes 2013-07-07 01:57:57 +00:00
parent b6a4d39596
commit fb41d668ed

View File

@ -163,7 +163,8 @@ public:
ciAiTransCacheMutex.leave();
UErrorCode errorCode = U_ZERO_ERROR;
ret = utransOpen("Any-Upper; NFD; [:Nonspacing Mark:] Remove; NFC",
// Fix for CORE-4136. Was "Any-Upper; NFD; [:Nonspacing Mark:] Remove; NFC".
ret = utransOpen("NFD; [:Nonspacing Mark:] Remove; NFC",
UTRANS_FORWARD, NULL, 0, NULL, &errorCode);
}
@ -1446,16 +1447,19 @@ SSHORT UnicodeUtil::Utf16Collation::compare(ULONG len1, const USHORT* str1,
ULONG UnicodeUtil::Utf16Collation::canonical(ULONG srcLen, const USHORT* src, ULONG dstLen, ULONG* dst,
const ULONG* exceptions)
{
HalfStaticArray<USHORT, BUFFER_SMALL / 2> upperStr;
if ((attributes & (TEXTTYPE_ATTR_CASE_INSENSITIVE | TEXTTYPE_ATTR_ACCENT_INSENSITIVE)) ==
(TEXTTYPE_ATTR_CASE_INSENSITIVE | TEXTTYPE_ATTR_ACCENT_INSENSITIVE))
{
fb_assert(srcLen % sizeof(*src) == 0);
memcpy(upperStr.getBuffer(srcLen / sizeof(USHORT)), src, srcLen);
HalfStaticArray<USHORT, BUFFER_SMALL / 2> upperStr;
if (attributes & TEXTTYPE_ATTR_CASE_INSENSITIVE)
{
srcLen = utf16UpperCase(srcLen, src, srcLen,
upperStr.getBuffer(srcLen / sizeof(USHORT)), NULL);
src = upperStr.begin();
if (attributes & TEXTTYPE_ATTR_ACCENT_INSENSITIVE)
{
UTransliterator* trans = icu->getCiAiTransliterator();
if (trans)
@ -1474,16 +1478,10 @@ ULONG UnicodeUtil::Utf16Collation::canonical(ULONG srcLen, const USHORT* src, UL
len = INTL_BAD_STR_LENGTH;
srcLen = len;
src = upperStr.begin();
}
else
return INTL_BAD_STR_LENGTH;
}
else if (attributes & TEXTTYPE_ATTR_CASE_INSENSITIVE)
{
srcLen = utf16UpperCase(srcLen, src,
srcLen, upperStr.getBuffer(srcLen / sizeof(USHORT)), exceptions);
src = upperStr.begin();
}
// convert UTF-16 to UTF-32