| 517 | #endif |
| 518 | |
| 519 | bool IsStringUTF8(const StringPiece& str) { |
| 520 | const char *src = str.data(); |
| 521 | int32_t src_len = static_cast<int32_t>(str.length()); |
| 522 | int32_t char_index = 0; |
| 523 | |
| 524 | while (char_index < src_len) { |
| 525 | int32_t code_point; |
| 526 | CBU8_NEXT(src, char_index, src_len, code_point); |
| 527 | if (!IsValidCharacter(code_point)) |
| 528 | return false; |
| 529 | } |
| 530 | return true; |
| 531 | } |
| 532 | |
| 533 | // Implementation note: Normally this function will be called with a hardcoded |
| 534 | // constant for the lowercase_ascii parameter. Constructing a StringPiece from |
no test coverage detected