Permalink
Browse files

Fix utfgrid text encoding to work with Windows (#5342)

  • Loading branch information...
1 parent 93cc1ed commit 2ab0dc0187b0a89560d5ce88c1e1208a3def6108 geographika committed with tbonfort Oct 30, 2016
Showing with 7 additions and 1 deletion.
  1. +7 −1 maputfgrid.cpp
View
@@ -504,7 +504,13 @@ int utfgridSaveImage(imageObj *img, mapObj *map, FILE *fp, outputFormatObj *form
/* Conversion to UTF-8 encoding */
*stringptr = '\0';
char * utf8;
- utf8 = msConvertWideStringToUTF8 (string, "UCS-4LE");
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ const char* encoding = "UCS-2LE";
+#else
+ const char* encoding = "UCS-4LE";
+#endif
+
+ utf8 = msConvertWideStringToUTF8(string, encoding);
msIO_fprintf(fp,"%s", utf8);
msFree(utf8);
msFree(string);

0 comments on commit 2ab0dc0

Please sign in to comment.