[mapserver-commits] r8502 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Feb 5 11:12:44 EST 2009


Author: hobu
Date: 2009-02-05 11:12:44 -0500 (Thu, 05 Feb 2009)
New Revision: 8502

Modified:
   trunk/mapserver/mapsde.c
Log:
attempt to fix #2878, endianness NSTRING with SDE

Modified: trunk/mapserver/mapsde.c
===================================================================
--- trunk/mapserver/mapsde.c	2009-02-05 04:15:11 UTC (rev 8501)
+++ trunk/mapserver/mapsde.c	2009-02-05 16:12:44 UTC (rev 8502)
@@ -69,6 +69,7 @@
   SE_COLUMN_DEF *joindefs;
   short *nBaseColumns;
   short *nJoinColumns;
+  int bBigEndian;
 } msSDELayerInfo;
 
 typedef struct {
@@ -747,7 +748,10 @@
                                 "SE_stream_get_string()");
                     return(MS_FAILURE);
                 } else {
-                    shape->values[i] = msConvertWideStringToUTF8((const wchar_t*) wide, "UTF-16");
+                    if (sde->bBigEndian)
+                        shape->values[i] = msConvertWideStringToUTF8((const wchar_t*) wide, "UTF-16BE");
+                    else
+                        shape->values[i] = msConvertWideStringToUTF8((const wchar_t*) wide, "UTF-16LE");
                     msFree(wide);
                 }
                 break;
@@ -1005,6 +1009,7 @@
 int msSDELayerOpen(layerObj *layer) {
 #ifdef USE_SDE
     long status=-1;
+    int endian_test=1;
     char **params=NULL;
     char **data_params=NULL;
     char *join_table=NULL;
@@ -1314,6 +1319,12 @@
         return(MS_FAILURE);
     }  
 
+    /* Determine if we are big or little- endian for */
+    /* working with the encoding */
+    if( *((unsigned char *) &endian_test) == 1 )
+        sde->bBigEndian = MS_TRUE;
+    else
+        sde->bBigEndian = MS_FALSE;
 
     /* point to the SDE layer information  */
     /* (note this might actually be in another layer) */



More information about the mapserver-commits mailing list