changeset 74:f794f2baabf2

Added codepage translation for Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 18 Feb 2002 19:10:28 +0000
parents 2f339dd13496
children c629838d9805
files compat.c
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/compat.c	Mon Feb 18 08:43:34 2002 +0000
+++ b/compat.c	Mon Feb 18 19:10:28 2002 +0000
@@ -764,6 +764,36 @@
 	}
 }
 
+#ifdef __WIN32__
+#define LOCALE_CHARACTERS 62
+static char locale_table[LOCALE_CHARACTERS * 2] = {
+	0xc0, 0xb7, 0xc1, 0xb5, 0xc2, 0xb6, 0xc3, 0xc7, 0xc4, 0x8e, 0xc5, 0x8f,
+	0xc6, 0x92, 0xc7, 0x80, 0xc8, 0xd4, 0xc9, 0x90, 0xcb, 0xd3, 0xcc, 0xde,
+	0xcd, 0xd6, 0xce, 0xd7, 0xcf, 0xd8, 0xd0, 0xd1, 0xd1, 0xa5, 0xd2, 0xe3,
+	0xd3, 0xe0, 0xd4, 0xe2, 0xd5, 0xe5, 0xd6, 0x99, 0xd8, 0x9d, 0xd9, 0xeb,
+	0xda, 0xe9, 0xdb, 0xea, 0xdc, 0x9a, 0xde, 0xed, 0xde, 0xe8, 0xdf, 0xe1,
+	0xe0, 0x85, 0xe1, 0xa0, 0xe2, 0x83, 0xe3, 0xc6, 0xe4, 0x84, 0xe5, 0x86,
+	0xe6, 0x91, 0xe7, 0x87, 0xe8, 0x8a, 0xe9, 0x82, 0xea, 0x88, 0xeb, 0x89,
+	0xec, 0x8d, 0xed, 0xa1, 0xee, 0x8c, 0xef, 0x8b, 0xf0, 0xd0, 0xf1, 0xa4,
+	0xf2, 0x95, 0xf3, 0xa3, 0xf4, 0x93, 0xf5, 0xe4, 0xf6, 0x94, 0xf7, 0xf6,
+	0xf8, 0x9b, 0xf9, 0x97, 0xfa, 0xa3, 0xfb, 0x96, 0xfc, 0x81, 0xfd, 0xec,
+    0xfe, 0xe7, 0xff, 0x9e
+
+};
+
+char locale_convert(int codepage, char c)
+{
+	int z;
+
+	for(z=0;z<LOCALE_CHARACTERS;z++)
+	{
+		if(locale_table[(z*2)+1] == c)
+			return locale_table[z*2];
+	}
+	return c;
+}
+#endif
+
 /* Initialize the locale engine
  * Returns: TRUE on success, FALSE on failure.
  */
@@ -836,7 +866,11 @@
 							}
 							else
 							{
+#ifdef __WIN32__
+								locale_text[current][x] = locale_convert(1252, text[z]);
+#else
 								locale_text[current][x] = text[z];
+#endif
 								x++;
 							}
 						}