[mapguide-commits] r9017 - sandbox/adsk/3.0m/Common/CoordinateSystem
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Aug 9 22:35:15 PDT 2016
Author: christinebao
Date: 2016-08-09 22:35:15 -0700 (Tue, 09 Aug 2016)
New Revision: 9017
Modified:
sandbox/adsk/3.0m/Common/CoordinateSystem/CoordSysUtil.h
Log:
#2735: Cannot read some user defined coordinate systems.
The CsMap dictionary string encoding was changed to UTF8 (see ticket #2508 ?\226?\128?\139http://trac.osgeo.org/mapguide/ticket/2508). All strings in CsMap dictionaries were changed to UTF8 too. But if it is an user defined CS and the description of the CS contains characters which are not UTF8, loading the CS will fail. In order to load the CS, we remove invalid characters when loading it.
Modified: sandbox/adsk/3.0m/Common/CoordinateSystem/CoordSysUtil.h
===================================================================
--- sandbox/adsk/3.0m/Common/CoordinateSystem/CoordSysUtil.h 2016-07-28 08:58:03 UTC (rev 9016)
+++ sandbox/adsk/3.0m/Common/CoordinateSystem/CoordSysUtil.h 2016-08-10 05:35:15 UTC (rev 9017)
@@ -101,7 +101,20 @@
if (str == 0)
return 0;
- return MgUtil::MultiByteToWideChar(str);
+ // Check input, discard invalid charactors
+ size_t len = strlen(str);
+ char* tempstr = new char[len+1];
+ size_t pos = 0;
+ for (size_t i = 0; i < len; i++)
+ {
+ if (str[i] > 0)
+ tempstr[pos++] = str[i];
+ }
+ tempstr[pos] = '\0';
+
+ wchar_t* ret = MgUtil::MultiByteToWideChar(tempstr);
+ delete []tempstr;
+ return ret;
}
inline char *
More information about the mapguide-commits
mailing list