9
« on: January 13, 2025, 11:03:29 am »
We use only 2 non-printing characters in strings really.
Unicode::replace(s, "{SMALLLINE}", "\x02"); // Unicode::TOK_NL_SMALL
Unicode::replace(s, "{ALT}", "\x01"); // Unicode::TOK_COLOR_FLIP
And from all fields in the save file, only 1 or 2 can actually contain them.
I wanted to manually replace \x01 with \\x01 but saving it was a bit confusing.
The same string gets saved differently depending on whether quotes are used or not.
See below, why is that the case?
std::string converted = "abc\\x01def";
headerWriter.write("craftOrBase", converted).setAsQuoted();
headerWriter.write("craftOrBase2", converted);
craftOrBase: "abc\\x01def"
craftOrBase2: abc\x01def
I would like to save it as
craftOrBase: "abc\x01def"
but I could not find a way how to do that?