Automatic discrimination text is a C # program of UTF-8.

xiaoxiao2021-03-06  108

private void FindNoUTFFile (string Path) {System.IO.StreamReader reader = null; StringBuilder sb; StringBuilder sb2; DirectoryInfo Folder = new System.IO.DirectoryInfo (Path); DirectoryInfo [] subFolders = Folder.GetDirectories (); for (int i = 0; i

Private Static Bool ISUTF8 {INT I; BYTE COCTETS; // OCTETS TO GO IN THIS UTF-8 Encoded Character Byte Chr; Bool Ballascii = True; Long Ilen = SbinputStream.length;

COCTETS = 0; for (i = 0; I

IF ((chr & 0x80)! = 0) BALLASCII = FALSE

IF (COCTETS == 0) {if (chr> = 0x80) {DO {chr << = 1; COCTETS ;} while ((chr & 0x80)! = 0); cocTes--; if (cocTets == 0) Return false;}} else {= ((chr & 0xc0)! = 0x80) {return false;} cocTets--;}

IF (coctets> 0) {RETURN FALSE;}

IF (Ballascii) {Return False;}

Return True;

}}}

转载请注明原文地址:https://www.9cbs.com/read-103535.html

New Post(0)