mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-09 16:41:14 +02:00
fix for P2 Metadata in imported files can cause the .aup to store unhandled characters.
This commit is contained in:
parent
41dc1f2f6c
commit
635931c6be
@ -34,6 +34,16 @@ the general functionality for creating XML in UTF8 encoding.
|
|||||||
#include "XMLWriter.h"
|
#include "XMLWriter.h"
|
||||||
#include "XMLTagHandler.h"
|
#include "XMLTagHandler.h"
|
||||||
|
|
||||||
|
#include "../../lib-src/expat/xmltok/xmltok_impl.h"
|
||||||
|
static int charXMLCompatiblity[] =
|
||||||
|
{
|
||||||
|
#define BT_COLON BT_NMSTRT
|
||||||
|
#include "../../lib-src/expat/xmltok/asciitab.h"
|
||||||
|
#undef BT_COLON
|
||||||
|
#include "../../lib-src/expat/xmltok/latin1tab.h"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// XMLWriter base class
|
/// XMLWriter base class
|
||||||
///
|
///
|
||||||
@ -274,7 +284,14 @@ wxString XMLWriter::XMLEsc(const wxString & s)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
if (!wxIsprint(c)) {
|
if (!wxIsprint(c)) {
|
||||||
result += wxString::Format(wxT("&#x%04x;"), c);
|
//ignore several characters such ase eot (0x04) and stx (0x02) because it makes expat parser bail
|
||||||
|
//see xmltok.c in expat checkCharRefNumber() to see how expat bails on these chars.
|
||||||
|
//also see lib-src/expat/xmltok/asciitab.h to see which characters are nonxml compatible post decode
|
||||||
|
//(we can still encode '&' and '<' with this table, but it prevents us from encoding eot)
|
||||||
|
//the table only goes up to 0x7F, so we don't check higher than this.
|
||||||
|
//this assumes that c as ascii compatible, which utf8 is.
|
||||||
|
if(c> 0x7F || charXMLCompatiblity[c]!=BT_NONXML)
|
||||||
|
result += wxString::Format(wxT("&#x%04x;"), c);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result += c;
|
result += c;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user