bca6edaef4f6d3c6a55282c4414936b624a1b54b
braney
  Mon Oct 28 12:56:15 2024 -0700
prevent iconv from bailing just because it can't translate a UTF-8
string

diff --git src/lib/psGfx.c src/lib/psGfx.c
index 611955a..e2e4d94 100644
--- src/lib/psGfx.c
+++ src/lib/psGfx.c
@@ -250,31 +250,31 @@
 
 /* Note the 1.2 and the 1.0 below seem to get it to 
  * position about where the stuff developed for pixel
  * based systems expects it.  It is all a kludge though! */
 fprintf(f, "%f scalefont setfont\n", -size*ps->yScale*1.2);
 ps->fontHeight = size*0.8;
 }
 
 static iconv_t ourIconv; // convert context UTF-8 > Windows 1252
 
 static size_t utf8ToWindows1252(char *text, unsigned char *buffer, size_t nLength)
 /* Convert UTF-8 string to Unicode string. */
 {
 if (ourIconv == NULL)
     {
-    ourIconv = iconv_open("WINDOWS-1252//", "UTF-8");
+    ourIconv = iconv_open("WINDOWS-1252//TRANSLIT", "UTF-8");
         
     if (ourIconv == NULL)
         errAbort("iconv problem errno %d\n",errno);
     }
 
 size_t length = strlen(text);
 char *newText = (char *)buffer;
 
 int ret = iconv(ourIconv, &text, &length, &newText,  &nLength);
 
 if (ret < 0)
     errAbort("iconv problem errno %d\n",errno);
 
 return (newText - (char *)buffer);
 }