catalin wrote: ↑Fri Aug 07, 2020 3:10 am
Did you mean "non-printable" as in "not on the keyboard"? Because it looks like
0x0500 does have a glyph.
And you probably need to escape it inside the wxString that you use to write the xml, in which case you'd be better off by finding its utf8 representation and using that, which in your case should be wxString::FromUTF8("Choose another one?\xD4\x80").
Unicode Support in wxWidgets might help.
Thanks for the reply.
With non-printable, I mean chars that can not be printed. Check
isprint.
The UTF-8 representation of 0x0500 (unicode) is the same as UTF-8 (0x05), but with only one char.
I searched more over the network and I found that is not possible to scape these non-printable chars in XML using the  syntax (sorry for not find this information before, I thought this was an error from wxWidgets).
So, I'm saving with
Code: Select all
wxString::Replace(L'\x5', L"[END]", true)
and loading with
Code: Select all
wxString::Replace(L"[END]", L'\x5', true)
This is a bit hacky, since I will find others non-printable chars in the future, but does the jog for now.
While I was wiriting this, I found in
this site that control characters (from 0x00 to 0x08) are allowed in XML version 1.1. I tried to set my xml doc to version 1.1, but the xml parser don't allow this character even with version 1.1.
Code: Select all
wxXmlDocument doc;
doc.SetVersion(L"1.1");
I guess that changing this are only semantic and only affects the xml output, not the parser at all.
Code: Select all
<?xml version="1.1" encoding="UTF-16"?>
<ROM-String start="000F0E7C" size="00000008">
<String references="00004EFC">Player[0x0500]</String>
</ROM-String>
or
Code: Select all
<?xml version="1.1" encoding="UTF-16"?>
<ROM-String start="000F0E7C" size="00000008">
<String references="00004EFC">Player</String>
</ROM-String>
Please note that [0x0500] are the raw (ENQ) character in the document. I can't paste it here. Try opening the Notepad++ and pressing CTRL+E. That's (and others) the character I want to escape.