diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2014-06-28 17:14:57 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2014-09-05 09:52:22 +0200 |
commit | b0b4a721b4f33ef132fcbdf4e5069c11269b121e (patch) | |
tree | 0e6807d83d9c57cf117ed86acae8296f50f15ce4 /connectivity | |
parent | 22a13cab85398846ed521989531f9471b9a1835a (diff) |
odbc: no, RTL_TEXTENCODING_UCS2/4 doesn't work as we intended
Change-Id: Ie1bcbb41319f5ddfd349f6ef1ec888715ab2b9e2
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/odbc/OTools.cxx | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/connectivity/source/drivers/odbc/OTools.cxx b/connectivity/source/drivers/odbc/OTools.cxx index fe3b391761aa..b38564df7a6c 100644 --- a/connectivity/source/drivers/odbc/OTools.cxx +++ b/connectivity/source/drivers/odbc/OTools.cxx @@ -416,14 +416,8 @@ OUString OTools::getStringValue(OConnection* _pConnection, { SQLWCHAR waCharArray[2048]; BOOST_STATIC_ASSERT(sizeof(waCharArray) % sizeof(SQLWCHAR) == 0); - rtl_TextEncoding nSQLWCHAREncoding = RTL_TEXTENCODING_UCS2; BOOST_STATIC_ASSERT(sizeof(SQLWCHAR) == 2 || sizeof(SQLWCHAR) == 4); - if(sizeof(SQLWCHAR) == 4) - { - // we assume LibO uses UTF-16 and & ODBC uses UCS4 (UTF-32); see OPreparedStatement::setParameter - nSQLWCHAREncoding = RTL_TEXTENCODING_UCS4; - } - // Size == number of bytes, Len == number of UTF-16 code units + // Size == number of bytes, Len == number of UTF-16 or UCS4 code units const SQLLEN nMaxSize = sizeof(waCharArray); const SQLLEN nMaxLen = sizeof(waCharArray) / sizeof(SQLWCHAR); BOOST_STATIC_ASSERT(nMaxLen * sizeof(SQLWCHAR) == nMaxSize); @@ -463,7 +457,17 @@ OUString OTools::getStringValue(OConnection* _pConnection, nReadChars = pcbValue/sizeof(SQLWCHAR); } - aData.append(OUString((sal_Char*)waCharArray, nReadChars, nSQLWCHAREncoding)); + if (sizeof (SQLWCHAR) == 2) + { + aData.append(waCharArry, nReadChars); + } + else + { + for (sal_Int32 i = 0; i < nReadChars; ++i) + { + aData.appendUtf32(waCharArray[i]); + } + } } break; } |