[mapguide-commits] r8694 - sandbox/adsk/3.0m/Common/Stylization
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Jul 1 23:10:03 PDT 2015
Author: hubu
Date: 2015-07-01 23:10:03 -0700 (Wed, 01 Jul 2015)
New Revision: 8694
Modified:
sandbox/adsk/3.0m/Common/Stylization/KeyEncode.cpp
Log:
#2562, Linux: Select feature doesn't work when type of key column is string.
In Linux, when the key column of a feature class is string type, select feature on this layer doesn't work. The feature is not highlighted, the selection panel is empty either.
I found that the API SelectFeatures works well. The value of the key column is correct. But after encoding it to base64 string, it becomes 'AAAA', which means an empty string. So the error is in encoding key.
wchar is UTF32 in Linux, while it is UTF16 in Windows. In Linux, we will first convert the wide string to UTF16, then convert the UTF16 string to UTF8. Something is wrong during the 2 conversions. Now I change it to use UTF32toUTF8 directly. The result is correct after the change.
Modified: sandbox/adsk/3.0m/Common/Stylization/KeyEncode.cpp
===================================================================
--- sandbox/adsk/3.0m/Common/Stylization/KeyEncode.cpp 2015-06-30 02:48:10 UTC (rev 8693)
+++ sandbox/adsk/3.0m/Common/Stylization/KeyEncode.cpp 2015-07-02 06:10:03 UTC (rev 8694)
@@ -199,8 +199,12 @@
void KeyEncode::WriteString(const wchar_t* src)
{
std::string sutf8;
+ #ifdef _WIN32
const XMLCh* srcX = W2X(src);
UnicodeString::UTF16toUTF8(srcX, sutf8);
+ #else
+ UnicodeString::UTF32toUTF8((const LCh*)src, sutf8);
+ #endif
size_t nUsed = sutf8.length();
WriteBytes((unsigned char*)sutf8.c_str(), nUsed+1);
}
More information about the mapguide-commits
mailing list