Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/teraterm/teraterm/vtterm.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 7427 by zmatsuo, Sun Feb 10 16:12:40 2019 UTC revision 7430 by zmatsuo, Sun Feb 17 14:43:54 2019 UTC
# Line 5519  static void UnicodeToCP932(unsigned int Line 5519  static void UnicodeToCP932(unsigned int
5519  }  }
5520    
5521  // UTF-8で受信データを処理する  // UTF-8で受信データを処理する
 BOOL ParseFirstUTF8(BYTE b, int proc_combining)  
5522  // returns TRUE if b is processed  // returns TRUE if b is processed
5523  //  (actually allways returns TRUE)  //  (actually allways returns TRUE)
5524    static BOOL ParseFirstUTF8(BYTE b, int proc_combining)
5525  {  {
5526          static BYTE buf[3];          static BYTE buf[4];
5527          static int count = 0;          static int count = 0;
5528          static int can_combining = 0;          static int can_combining = 0;
5529          static unsigned int first_code;          static unsigned int first_code;
# Line 5586  BOOL ParseFirstUTF8(BYTE b, int proc_com Line 5586  BOOL ParseFirstUTF8(BYTE b, int proc_com
5586                  return TRUE;                  return TRUE;
5587          }          }
5588    
5589          if ((buf[0] & 0xe0) == 0xe0 &&          if ((buf[0] & 0xf0) == 0xe0 &&
5590                  (buf[1] & 0xc0) == 0x80 &&                  (buf[1] & 0xc0) == 0x80 &&
5591                  (buf[2] & 0xc0) == 0x80) { // 3バイトコードの場合                  (buf[2] & 0xc0) == 0x80) { // 3バイトコードの場合
5592    
# Line 5643  BOOL ParseFirstUTF8(BYTE b, int proc_com Line 5643  BOOL ParseFirstUTF8(BYTE b, int proc_com
5643  skip:  skip:
5644                  count = 0;                  count = 0;
5645    
5646            }
5647    
5648            if (count < 4) {
5649                    return TRUE;
5650            }
5651    
5652            if ((buf[0] & 0xf1) == 0xf0 &&
5653                    (buf[1] & 0xc0) == 0x80 &&
5654                    (buf[2] & 0xc0) == 0x80 &&
5655                    (buf[2] & 0xc0) == 0x80)
5656            {       // 4バイトコードの場合
5657                    code = ((buf[0] & 0x07) << 18);
5658                    code |= ((buf[1] & 0x3f) << 12);
5659                    code |= ((buf[2] & 0x3f) << 6);
5660                    code |= (buf[3] & 0x3f);
5661    
5662                    UnicodeToCP932(code);
5663                    count = 0;
5664                    return TRUE;
5665          } else {          } else {
5666                  ParseASCII(buf[0]);                  ParseASCII(buf[0]);
5667                  ParseASCII(buf[1]);                  ParseASCII(buf[1]);
5668                  ParseASCII(buf[2]);                  ParseASCII(buf[2]);
5669                    ParseASCII(buf[3]);
5670                  count = 0;                  count = 0;
   
5671          }          }
5672    
5673          return TRUE;          return TRUE;

Legend:
Removed from v.7427  
changed lines
  Added in v.7430

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26