[mapguide-commits] r9018 - trunk/MgDev/Common/CoordinateSystem

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Aug 9 22:38:42 PDT 2016


Author: christinebao
Date: 2016-08-09 22:38:41 -0700 (Tue, 09 Aug 2016)
New Revision: 9018

Modified:
   trunk/MgDev/Common/CoordinateSystem/CoordSysUtil.h
Log:
Merged revision(s) 9017 from sandbox/adsk/3.0m/Common/CoordinateSystem:
#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: trunk/MgDev/Common/CoordinateSystem/CoordSysUtil.h
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysUtil.h	2016-08-10 05:35:15 UTC (rev 9017)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysUtil.h	2016-08-10 05:38:41 UTC (rev 9018)
@@ -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