StreamReader file = File.OpenText(@"D:\11.txt");
byte[] b = file.CurrentEncoding.GetPreamble();
위와 같이 오픈한 해당 파일의
"byte-order mark" 를 가져온 뒤
byte배열에 들어있는 값을
아래표와 비교하시면 됨
=========
Encoding | Representation (hexadecimal) | Representation (decimal) |
---|---|---|
UTF-8 | EF BB BF † |
239 187 191 |
UTF-16 (BE) | FE FF |
254 255 |
UTF-16 (LE) | FF FE |
255 254 |
UTF-32 (BE) | 00 00 FE FF |
0 0 254 255 |
UTF-32 (LE) | FF FE 00 00 |
255 254 0 0 |
UTF-7 | 2B 2F 76 , and one of the following bytes: [ 38 | 39 | 2B | 2F ] † |
43 47 and one of the following bytes: [ 56 | 57 | 43 | 47 ] |
UTF-1 | F7 64 4C |
247 100 76 |
UTF-EBCDIC | DD 73 66 73 |
221 115 102 115 |
SCSU | 0E FE FF † |
14 254 255 |
BOCU-1 | FB EE 28 optionally followed by FF † |
251 238 40 optionally followed by 255 |
댓글 없음:
댓글 쓰기