Changeset 1927
- Timestamp:
- 2001-02-08T13:17:33+13:00 (23 years ago)
- Location:
- trunk/gsdl
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/etc/main.cfg
r1904 r1927 89 89 # option is mandatory for all encoding lines except the 90 90 # special case for utf8. 91 # multibyte -- This optional argument should be set for all encodings that use 92 # multibyte characters. 91 93 92 94 # The utf8 encoding is handled internally and doesn't require a map file. … … 125 127 126 128 # CJK encodings (note that Shift-JIS Japanese isn't currently supported) 127 Encoding shortname=gbk "longname=Chinese Simplified (GBK)" map=gbk.ump 128 Encoding shortname=big5 "longname=Chinese Traditional (Big5)" map=big5.ump 129 Encoding shortname=euc-jp "longname=Japanese (EUC)" map=euc_jp.ump 130 Encoding shortname=euc-kr "longname=Korean (UHC)" map=uhc.ump 129 Encoding shortname=gbk "longname=Chinese Simplified (GBK)" map=gbk.ump multibyte 130 Encoding shortname=big5 "longname=Chinese Traditional (Big5)" map=big5.ump multibyte 131 Encoding shortname=euc-jp "longname=Japanese (EUC)" map=euc_jp.ump multibyte 132 Encoding shortname=euc-kr "longname=Korean (UHC)" map=uhc.ump multibyte 131 133 132 134 -
trunk/gsdl/lib/gsdlunicode.cpp
r1870 r1927 384 384 385 385 mapinconvertclass::mapinconvertclass () { 386 multibyte = 0; 386 387 mapbuflen = 0; 387 388 } … … 425 426 // got a complete character 426 427 if (charlen == 1) { 427 // ascii character 428 output.push_back (mapbuf[0]); 428 if (mapbuf[0] < 0x80) { 429 // ascii character 430 output.push_back (mapbuf[0]); 431 } else { 432 output.push_back (converter.convert((unsigned short)mapbuf[0])); 433 } 429 434 430 435 } else { … … 448 453 449 454 mapoutconvertclass::mapoutconvertclass () { 455 multibyte = 0; 450 456 mapbuflen=0; 451 457 mapbufhere=0; … … 500 506 } else { 501 507 outc = converter.convert (*texthere); 502 mapbuf[0] = (unsigned char)(outc >> 8); 503 mapbuf[1] = (unsigned char)(outc & 0xff); 504 mapbuflen = 2; 508 if (multibyte) { 509 mapbuf[0] = (unsigned char)(outc >> 8); 510 mapbuf[1] = (unsigned char)(outc & 0xff); 511 mapbuflen = 2; 512 } else { 513 mapbuf[0] = outc; 514 mapbuflen = 1; 515 } 505 516 } 506 517 } -
trunk/gsdl/lib/gsdlunicode.h
r1870 r1927 153 153 }; 154 154 155 void set_multibyte (int new_multibyte) {multibyte = new_multibyte;}; 156 155 157 void reset (); 156 158 void convert (text_t &output, status_t &status); … … 160 162 unsigned char mapbuf[MAXMAPCHARLEN]; 161 163 size_t mapbuflen; 164 int multibyte; 162 165 163 166 // note: multiple instances of mapinconvert class are expensive … … 172 175 if (mapbuflen == 0) return 0; 173 176 if (mapbuf[0] < 0x80) return 1; 177 if (!multibyte) return 1; 174 178 return 2; 175 179 } … … 194 198 }; 195 199 200 void set_multibyte (int new_multibyte) {multibyte = new_multibyte;}; 201 196 202 void reset (); 197 203 void convert (char *output, size_t maxlen, … … 202 208 size_t mapbuflen; 203 209 size_t mapbufhere; 210 int multibyte; 204 211 205 212 mapconvert converter; -
trunk/gsdl/src/recpt/receptionist.cpp
r1877 r1927 1300 1300 1301 1301 text_t subkey, subvalue, shortname, longname, mapfile; 1302 int multibyte = 0; 1302 1303 text_t::const_iterator cfglinesub_here; 1303 1304 text_tarray::const_iterator cfgline_here = cfgline.begin(); 1304 1305 text_tarray::const_iterator cfgline_end = cfgline.end(); 1305 1306 while (cfgline_here != cfgline_end) { 1306 cfglinesub_here = getdelimitstr((*cfgline_here).begin(), 1307 (*cfgline_here).end(), '=', subkey); 1308 if (subkey == "shortname") { 1309 shortname = substr (cfglinesub_here, (*cfgline_here).end()); 1310 } else if (subkey == "longname") { 1311 longname = substr (cfglinesub_here, (*cfgline_here).end()); 1312 } else if (subkey == "map") { 1313 mapfile = substr (cfglinesub_here, (*cfgline_here).end()); 1307 if (*cfgline_here == "multibyte") { 1308 multibyte = 1; 1309 } else { 1310 cfglinesub_here = getdelimitstr((*cfgline_here).begin(), 1311 (*cfgline_here).end(), '=', subkey); 1312 if (subkey == "shortname") { 1313 shortname = substr (cfglinesub_here, (*cfgline_here).end()); 1314 } else if (subkey == "longname") { 1315 longname = substr (cfglinesub_here, (*cfgline_here).end()); 1316 } else if (subkey == "map") { 1317 mapfile = substr (cfglinesub_here, (*cfgline_here).end()); 1318 } 1314 1319 } 1315 1320 cfgline_here++; … … 1345 1350 mapinconvertclass *mapinconvert = new mapinconvertclass(); 1346 1351 mapinconvert->setmapfile (to_uc_map, 0x003F); 1352 mapinconvert->set_multibyte (multibyte); 1347 1353 mapoutconvertclass *mapoutconvert = new mapoutconvertclass(); 1348 1354 mapoutconvert->setmapfile (from_uc_map, 0x3F); 1355 mapoutconvert->set_multibyte (multibyte); 1349 1356 mapoutconvert->set_rzws(1); 1350 1357 add_converter (shortname, mapinconvert, mapoutconvert);
Note:
See TracChangeset
for help on using the changeset viewer.