Show
Ignore:
Timestamp:
08.02.2001 13:17:33 (19 years ago)
Author:
sjboddie
Message:

Fixed a bug in the C++ encoding support - 8 bit encodings like windows-1251
were being treated as 16 bit encodings in some places

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/lib/gsdlunicode.cpp

    r1870 r1927  
    384384 
    385385mapinconvertclass::mapinconvertclass () { 
     386  multibyte = 0; 
    386387  mapbuflen = 0; 
    387388} 
     
    425426      // got a complete character 
    426427      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    } 
    429434 
    430435      } else { 
     
    448453 
    449454mapoutconvertclass::mapoutconvertclass () { 
     455  multibyte = 0; 
    450456  mapbuflen=0;  
    451457  mapbufhere=0; 
     
    500506    } else { 
    501507      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      } 
    505516    } 
    506517      }