[mapguide-commits] r9063 - sandbox/adsk/3.1n/Common/CoordinateSystem

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sat Oct 8 18:10:06 PDT 2016


Author: christinebao
Date: 2016-10-08 18:10:06 -0700 (Sat, 08 Oct 2016)
New Revision: 9063

Modified:
   sandbox/adsk/3.1n/Common/CoordinateSystem/CoordSysUtil.h
Log:
Merged revision(s) 9017 from sandbox/adsk/3.0m/Common/CoordinateSystem:
Merge fix for #2735 to adsk/3.1n branch.

#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.1n/Common/CoordinateSystem/CoordSysUtil.h
===================================================================
--- sandbox/adsk/3.1n/Common/CoordinateSystem/CoordSysUtil.h	2016-10-06 18:15:46 UTC (rev 9062)
+++ sandbox/adsk/3.1n/Common/CoordinateSystem/CoordSysUtil.h	2016-10-09 01:10:06 UTC (rev 9063)
@@ -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