Browse Source

Made CharPointer_UTF8 more consistent in the way it handles broken sequences.

tags/2021-05-28
jules 11 years ago
parent
commit
492def9abf
1 changed files with 3 additions and 10 deletions
  1. +3
    -10
      modules/juce_core/text/juce_CharPointer_UTF8.h

+ 3
- 10
modules/juce_core/text/juce_CharPointer_UTF8.h View File

@@ -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;


Loading…
Cancel
Save