checkpoint. fixed cases for mbrtowc (was using 1 and 2 instead
of -1 and -2).
This commit is contained in:
parent
1f5cb6a96f
commit
e93a12868d
|
@ -299,14 +299,14 @@ CUnicode::textToUTF8(const CString& src, bool* errors)
|
||||||
for (const char* scan = src.c_str(); n > 0 && *scan != 0; ) {
|
for (const char* scan = src.c_str(); n > 0 && *scan != 0; ) {
|
||||||
size_t mblen = mbrtowc(NULL, scan, n, &state);
|
size_t mblen = mbrtowc(NULL, scan, n, &state);
|
||||||
switch (mblen) {
|
switch (mblen) {
|
||||||
case (size_t)2:
|
case (size_t)-2:
|
||||||
// incomplete last character. convert to unknown character.
|
// incomplete last character. convert to unknown character.
|
||||||
setError(errors);
|
setError(errors);
|
||||||
len += 1;
|
len += 1;
|
||||||
n = 0;
|
n = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (size_t)1:
|
case (size_t)-1:
|
||||||
// invalid character. count one unknown character and
|
// invalid character. count one unknown character and
|
||||||
// start at the next byte.
|
// start at the next byte.
|
||||||
setError(errors);
|
setError(errors);
|
||||||
|
|
Loading…
Reference in New Issue