Changeset 52594d1


Ignore:
Timestamp:
Jan 8, 2008, 12:11:55 AM (16 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
c277d89
Parents:
f9eea4c
Message:
* more strict utf-8 byte fetching.
This probably still needs more work.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    rc60ade2 r52594d1  
    557557        utf8buf[0] = j;
    558558
    559         if (~j & 0x20) bytes = 2;
    560         else if (~j & 0x10) bytes = 3;
    561         else if (~j & 0x08) bytes = 4;
    562         else if (~j & 0x04) bytes = 5;
    563         else if (~j & 0x02) bytes = 6;
    564         else bytes = 1; /* This won't validate */
    565 
     559        if ((j & 0xc0) && (~j & 0x20)) bytes = 2;
     560        else if ((j & 0xe0) && (~j & 0x10)) bytes = 3;
     561        else if ((j & 0xf0) && (~j & 0x08)) bytes = 4;
     562        else if ((j & 0xf8) && (~j & 0x04)) bytes = 5;
     563        else if ((j & 0xfc) && (~j & 0x02)) bytes = 6;
     564        else bytes = 1;
     565       
    566566        for (i = 1; i < bytes; i++) {
    567567          utf8buf[i] = wgetch(typwin);
Note: See TracChangeset for help on using the changeset viewer.