Skip to content

Commit 2ab0dc0

Browse files
geographikatbonfort
authored andcommitted
Fix utfgrid text encoding to work with Windows (#5342)
1 parent 93cc1ed commit 2ab0dc0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

maputfgrid.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,13 @@ int utfgridSaveImage(imageObj *img, mapObj *map, FILE *fp, outputFormatObj *form
504504
/* Conversion to UTF-8 encoding */
505505
*stringptr = '\0';
506506
char * utf8;
507-
utf8 = msConvertWideStringToUTF8 (string, "UCS-4LE");
507+
#if defined(_WIN32) && !defined(__CYGWIN__)
508+
const char* encoding = "UCS-2LE";
509+
#else
510+
const char* encoding = "UCS-4LE";
511+
#endif
512+
513+
utf8 = msConvertWideStringToUTF8(string, encoding);
508514
msIO_fprintf(fp,"%s", utf8);
509515
msFree(utf8);
510516
msFree(string);

0 commit comments

Comments
 (0)