| 201 | } |
| 202 | |
| 203 | CODE_ID Encode::DetectEncode(const uchar* pBuffer, int length, int &skip) |
| 204 | { |
| 205 | if (pBuffer[0] == 0xFF && pBuffer[1] == 0xFE) |
| 206 | { |
| 207 | skip = 2; |
| 208 | return CODE_ID::UNICODE_LE; //skip 2 |
| 209 | } |
| 210 | if (pBuffer[0] == 0xFE && pBuffer[1] == 0xFF) |
| 211 | { |
| 212 | skip = 2; |
| 213 | return CODE_ID::UNICODE_BE; //skip 2 |
| 214 | } |
| 215 | if (pBuffer[0] == 0xEF && pBuffer[1] == 0xBB && pBuffer[2] == 0xBF) |
| 216 | { |
| 217 | skip = 3; |
| 218 | return CODE_ID::UTF8_BOM; //skip 3 with BOM |
| 219 | } |
| 220 | |
| 221 | // 不能知道是不是UTF8 |
| 222 | CODE_ID code = CheckUnicodeWithoutBOM(pBuffer, length); |
| 223 | |
| 224 | skip = 0; |
| 225 | return code; //skip 0 |
| 226 | |
| 227 | } |
| 228 | |
| 229 | bool Encode::tranGbkToUNICODE(const char* pText, int length, QString &out) |
| 230 | { |
nothing calls this directly
no outgoing calls
no test coverage detected