summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/codepage_tables.c7
-rw-r--r--tools/codepage_tables.h1
-rw-r--r--tools/codepages.c22
3 files changed, 24 insertions, 6 deletions
diff --git a/tools/codepage_tables.c b/tools/codepage_tables.c
index 87e0da81a2..3f04c9df3e 100644
--- a/tools/codepage_tables.c
+++ b/tools/codepage_tables.c
@@ -57,6 +57,13 @@ const unsigned short cp1251_to_uni[] = {
57 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457 /* B8-BF */ 57 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457 /* B8-BF */
58}; 58};
59 59
60const unsigned short cp1252_to_uni[] = {
61 0x20AC, 0x00A0, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, /* 80-87 */
62 0x0c26, 0x2030, 0x0160, 0x2039, 0x0152, 0x00a0, 0x017D, 0x00a0, /* 88-8F */
63 0x00A0, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, /* 90-97 */
64 0x02dc, 0x2122, 0x0161, 0x203A, 0x0153, 0x00a0, 0x017E, 0x0178 /* 98-9F */
65};
66
60const unsigned short cp1256_to_uni[] = { 67const unsigned short cp1256_to_uni[] = {
61 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 68 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
62 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, 69 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688,
diff --git a/tools/codepage_tables.h b/tools/codepage_tables.h
index 5c74baa38f..208a4c9237 100644
--- a/tools/codepage_tables.h
+++ b/tools/codepage_tables.h
@@ -22,6 +22,7 @@
22extern const unsigned short iso8859_7_to_uni[]; 22extern const unsigned short iso8859_7_to_uni[];
23extern const unsigned short cp1250_to_uni[]; 23extern const unsigned short cp1250_to_uni[];
24extern const unsigned short cp1251_to_uni[]; 24extern const unsigned short cp1251_to_uni[];
25extern const unsigned short cp1252_to_uni[];
25extern const unsigned short cp1256_to_uni[]; 26extern const unsigned short cp1256_to_uni[];
26extern const unsigned short iso8859_2_to_uni[]; 27extern const unsigned short iso8859_2_to_uni[];
27extern const unsigned short cp932_table[]; 28extern const unsigned short cp932_table[];
diff --git a/tools/codepages.c b/tools/codepages.c
index 9c214397de..fb01c4dfb3 100644
--- a/tools/codepages.c
+++ b/tools/codepages.c
@@ -25,8 +25,8 @@
25 25
26#define MAX_TABLE_SIZE 32768 26#define MAX_TABLE_SIZE 32768
27 27
28static const int mini_index[6] = { 28static const int mini_index[7] = {
29 0, 1, 3, 6, 7, 8 29 0, 1, 3, 6, 7, 8, 9
30}; 30};
31 31
32static unsigned short iso_table[MAX_TABLE_SIZE]; 32static unsigned short iso_table[MAX_TABLE_SIZE];
@@ -140,7 +140,7 @@ unsigned short iso_decode(unsigned char *latin1, int cp, int count)
140 ucs = iso8859_2_to_uni[*latin1++ - 0xA1]; 140 ucs = iso8859_2_to_uni[*latin1++ - 0xA1];
141 } 141 }
142 break; 142 break;
143 143
144 case 0x08: /* Central European (CP1250) */ 144 case 0x08: /* Central European (CP1250) */
145 while (count--) { 145 while (count--) {
146 /* first convert to unicode */ 146 /* first convert to unicode */
@@ -150,7 +150,17 @@ unsigned short iso_decode(unsigned char *latin1, int cp, int count)
150 ucs = cp1250_to_uni[*latin1++ - 0x80]; 150 ucs = cp1250_to_uni[*latin1++ - 0x80];
151 } 151 }
152 break; 152 break;
153 153
154 case 0x09: /* Western European (CP1252) */
155 while (count--) {
156 /* first convert to unicode */
157 if (*latin1 < 0x80 || *latin1 >= 0xa0)
158 ucs = *latin1++;
159 else
160 ucs = cp1252_to_uni[*latin1++ - 0x80];
161 }
162 break;
163
154 default: 164 default:
155 break; 165 break;
156 } 166 }
@@ -209,7 +219,7 @@ int main(int argc, char **argv)
209 of = fopen("isomini.cp", "wb"); 219 of = fopen("isomini.cp", "wb");
210 if (!of) return 1; 220 if (!of) return 1;
211 221
212 for (i=1; i<6; i++) { 222 for (i=1; i<7; i++) {
213 223
214 for (j=0; j<128; j++) { 224 for (j=0; j<128; j++) {
215 k = (unsigned char)j + 128; 225 k = (unsigned char)j + 128;
@@ -223,7 +233,7 @@ int main(int argc, char **argv)
223 of = fopen("iso.cp", "wb"); 233 of = fopen("iso.cp", "wb");
224 if (!of) return 1; 234 if (!of) return 1;
225 235
226 for (i=1; i<9; i++) { 236 for (i=1; i<10; i++) {
227 237
228 for (j=0; j<128; j++) { 238 for (j=0; j<128; j++) {
229 k = (unsigned char)j + 128; 239 k = (unsigned char)j + 128;