| | @@ -326,25 +326,27 @@ |
| 326 | 326 | |
| 327 | 327 | /* |
| 328 | 328 | ** This function returns an array of bytes representing the byte-order-mark |
| 329 | 329 | ** for UTF-8. |
| 330 | 330 | */ |
| 331 | | -const unsigned char *get_utf8_bom(){ |
| 332 | | - static const unsigned char bom[] = { 0xEF, 0xBB, 0xBF }; |
| 331 | +const unsigned char *get_utf8_bom(int *pnByte){ |
| 332 | + static const unsigned char bom[] = { 0xEF, 0xBB, 0xBF, 0x00, 0x00, 0x00 }; |
| 333 | + if( pnByte ) *pnByte = 3; |
| 333 | 334 | return bom; |
| 334 | 335 | } |
| 335 | 336 | |
| 336 | 337 | /* |
| 337 | 338 | ** This function returns non-zero if the blob starts with a UTF-8 |
| 338 | 339 | ** byte-order-mark (BOM). |
| 339 | 340 | */ |
| 340 | 341 | int starts_with_utf8_bom(const Blob *pContent){ |
| 341 | 342 | const char *z = blob_buffer(pContent); |
| 342 | | - const unsigned char *bom = get_utf8_bom(); |
| 343 | + int bomSize; |
| 344 | + const unsigned char *bom = get_utf8_bom(&bomSize); |
| 343 | 345 | |
| 344 | | - if( blob_size(pContent)<3 ) return 0; |
| 345 | | - return memcmp(z, bom, 3)==0; |
| 346 | + if( blob_size(pContent)<bomSize ) return 0; |
| 347 | + return memcmp(z, bom, bomSize)==0; |
| 346 | 348 | } |
| 347 | 349 | |
| 348 | 350 | /* |
| 349 | 351 | ** This function returns non-zero if the blob starts with a UTF-16le or |
| 350 | 352 | ** UTF-16be byte-order-mark (BOM). |
| 351 | 353 | |