diff --git a/modules/juce_core/text/juce_CharPointer_UTF8.h b/modules/juce_core/text/juce_CharPointer_UTF8.h index d03c2a0ec4..78d9a975ee 100644 --- a/modules/juce_core/text/juce_CharPointer_UTF8.h +++ b/modules/juce_core/text/juce_CharPointer_UTF8.h @@ -171,11 +171,12 @@ public: while (--numExtraValues >= 0) { - const uint32 nextByte = (uint32) (uint8) *data++; + const uint32 nextByte = (uint32) (uint8) *data; if ((nextByte & 0xc0) != 0x80) break; + ++data; n <<= 6; n |= (nextByte & 0x3f); } @@ -248,16 +249,8 @@ public: if ((n & 0x80) != 0) { - uint32 bit = 0x40; - - while ((n & bit) != 0) - { + while ((*d & 0xc0) == 0x80) ++d; - bit >>= 1; - - if (bit == 0) - break; // illegal utf-8 sequence - } } else if (n == 0) break;