| 138 | } // namespace |
| 139 | |
| 140 | int Utf8CodepointBytes(const char* text) |
| 141 | { |
| 142 | if (!text || !*text) |
| 143 | return 0; |
| 144 | |
| 145 | int step = Utf8SequenceLength(static_cast<unsigned char>(text[0])); |
| 146 | for (int i = 1; i < step; ++i) |
| 147 | { |
| 148 | unsigned char c = static_cast<unsigned char>(text[i]); |
| 149 | if (c == 0 || !IsUtf8ContinuationByte(c)) |
| 150 | return i; |
| 151 | } |
| 152 | return step; |
| 153 | } |
| 154 | |
| 155 | int DecodeUtf8Codepoint(const char* text, uint32_t* outCodepoint) |
| 156 | { |
no test coverage detected