String::fromUTF8 stops at non-UTF ansi Umlaut


#1

I noticed the new build of Jucer 1.11 doesn’t load my old jucer-cpp files any more.
Older builds are working.

String::createStringFromData uses String::fromUTF8 (data, size) for encoding, and it breaks at my non-UTF8 ANSI “Ü” Hex 0xFC

[code]while (–numExtraValues >= 0 && i < (size_t) bufferSizeBytes)
{
const char nextByte = buffer[i];
if ((nextByte & 0xc0) != 0x80)
break;

[/code]
Did you change here something recently?

Maybe its better not to break and truncate the file, better ignore the character or use the ISO8859 table as a fallback ?

CallStack

String::fromUTF8 (data, size)
String::createStringFromData
FileInputStream::readEntireStreamAsString();
String File::loadFileAsString()
JucerDocument* loadDocumentFromFile


#2

Probably a better idea to actually save the cpp file in utf8, isn’t it…? I’d have thought these days that most editors would use utf8 by default?


#3

yes for me of course (i only edited the file with VC++ mmhhh… )

But String::fromUTF8 will be used in many circumstances, and a normal user doesn’t see the problem behind, he only see that his application does not work properly


#4

jules, this issue is still present in the old and the new Jucer, if there is a unknown char, the processing should not completely stopped, either it shoud ignore the char or it should jassert or give a error message back


#5

Could you email me an offending file so I can have a go myself?


#6

try to add this file into a jucer 3 project, and open it in the jucer text-editor, you will only see the first line


#7

When the code comment was Chinese, the problem will become even more serious, even undermine all code of post-edit or added.