Fix #113 editor_settings.xml corruption
In the `parse_tag` method of the `class ResourceInteractiveLoaderXML`, the class responsible of loading the editor_settings.xml file, the properties' values are loaded directly into an `String` object but the file contents are always UTF-8, which leads to garbage in the XML file when saved. This patch reads the properties' values in a `CharString` and translate them to UTF-8.
This commit is contained in:
parent
2bfbf89781
commit
b6583909a9
1 changed files with 9 additions and 7 deletions
|
@ -97,16 +97,17 @@ ResourceInteractiveLoaderXML::Tag* ResourceInteractiveLoaderXML::parse_tag(bool
|
||||||
|
|
||||||
if (!complete) {
|
if (!complete) {
|
||||||
String name;
|
String name;
|
||||||
String value;
|
CharString r_value;
|
||||||
bool reading_value=false;
|
bool reading_value=false;
|
||||||
|
|
||||||
while(!f->eof_reached()) {
|
while(!f->eof_reached()) {
|
||||||
|
|
||||||
CharType c=get_char();
|
CharType c=get_char();
|
||||||
if (c=='>') {
|
if (c=='>') {
|
||||||
if (value.length()) {
|
if (r_value.size()) {
|
||||||
|
|
||||||
tag.args[name]=value;
|
r_value.push_back(0);
|
||||||
|
tag.args[name].parse_utf8(r_value.get_data());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -115,17 +116,18 @@ ResourceInteractiveLoaderXML::Tag* ResourceInteractiveLoaderXML::parse_tag(bool
|
||||||
if (!reading_value && name.length()) {
|
if (!reading_value && name.length()) {
|
||||||
|
|
||||||
reading_value=true;
|
reading_value=true;
|
||||||
} else if (reading_value && value.length()) {
|
} else if (reading_value && r_value.size()) {
|
||||||
|
|
||||||
tag.args[name]=value;
|
r_value.push_back(0);
|
||||||
|
tag.args[name].parse_utf8(r_value.get_data());
|
||||||
name="";
|
name="";
|
||||||
value="";
|
r_value.clear();
|
||||||
reading_value=false;
|
reading_value=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (reading_value) {
|
} else if (reading_value) {
|
||||||
|
|
||||||
value+=c;
|
r_value.push_back(c);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
name+=c;
|
name+=c;
|
||||||
|
|
Loading…
Reference in a new issue