[mapserver-commits] r8504 - branches/branch-5-2/mapserver

svn at osgeo.org svn at osgeo.org
Thu Feb 5 11:37:57 EST 2009


Author: hobu
Date: 2009-02-05 11:37:57 -0500 (Thu, 05 Feb 2009)
New Revision: 8504

Modified:
   branches/branch-5-2/mapserver/mapsde.c
Log:
backport r8502 and r8503 for #2878

Modified: branches/branch-5-2/mapserver/mapsde.c
===================================================================
--- branches/branch-5-2/mapserver/mapsde.c	2009-02-05 16:20:16 UTC (rev 8503)
+++ branches/branch-5-2/mapserver/mapsde.c	2009-02-05 16:37:57 UTC (rev 8504)
@@ -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_FALSE;
+    else
+        sde->bBigEndian = MS_TRUE;
 
     /* point to the SDE layer information  */
     /* (note this might actually be in another layer) */



More information about the mapserver-commits mailing list