Add String::ascii creator functions, to parse a char buffer as ASCII.

The function will log errors if any characters above value 127 are found.
This commit is contained in:
Lukas Tenbrink
2025-03-08 00:01:27 +01:00
parent 7459a0361d
commit b6cfcdeab5
3 changed files with 41 additions and 2 deletions

View File

@ -383,14 +383,16 @@ void PListNode::store_text(String &p_stream, uint8_t p_indent) const {
p_stream += String("\t").repeat(p_indent);
p_stream += "<data>\n";
p_stream += String("\t").repeat(p_indent);
p_stream += String(data_string.get_data()) + "\n";
// Data should be Base64 (i.e. ASCII only).
p_stream += String::ascii(data_string) + "\n";
p_stream += String("\t").repeat(p_indent);
p_stream += "</data>\n";
} break;
case PList::PLNodeType::PL_NODE_TYPE_DATE: {
p_stream += String("\t").repeat(p_indent);
p_stream += "<date>";
p_stream += String(data_string.get_data());
// Data should be ISO 8601 (i.e. ASCII only).
p_stream += String::ascii(data_string);
p_stream += "</date>\n";
} break;
case PList::PLNodeType::PL_NODE_TYPE_STRING: {