Changeset 324:ba58cbca64a1

Show
Ignore:
Timestamp:
11/30/08 03:42:03 (1 month ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

More unicode checks

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/dwthelper/utils.d

    r323 r324  
    488488    } 
    489489    else{ 
     490        int steps = 0; 
    490491        while(( str[index] & 0xC0 ) is 0x80 ){ 
    491492            index--; 
     493            steps++; 
     494            if( steps > 3 || index < 0 ){ 
     495                break; 
     496            } 
     497        } 
     498        if((( str[index] & 0xE0 ) is 0xC0) && ( steps <= 1 )){ 
     499            // ok 
     500        } 
     501        else if((( str[index] & 0xF0 ) is 0xE0) && ( steps <= 2 )){ 
     502            // ok 
     503        } 
     504        else if((( str[index] & 0xF8 ) is 0xF0) && ( steps <= 3 )){ 
     505            // ok 
     506        } 
     507        else{ 
     508            tango.text.convert.Utf.onUnicodeError( "invalid utf8 input to toAbsoluteCodePointStartOffset" ); 
    492509        } 
    493510        return index;