fix : control character cause qdomdocument can not parse attribute

This commit is contained in:
Xiao YiFang 2022-06-11 16:25:56 +08:00
parent 3ed7ce5ccb
commit 9ea83f1299

View file

@ -336,6 +336,9 @@ bool MdictParser::readHeader( QDataStream & in )
headerTextUtf16.clear(); headerTextUtf16.clear();
in.setByteOrder( QDataStream::BigEndian ); in.setByteOrder( QDataStream::BigEndian );
//with this control character ,qt6.x can not parse attribute value.
headerText.remove(QRegularExpression("\\p{C}"));
QDomNamedNodeMap headerAttributes = parseHeaderAttributes( headerText ); QDomNamedNodeMap headerAttributes = parseHeaderAttributes( headerText );
encoding_ = headerAttributes.namedItem( "Encoding" ).toAttr().value(); encoding_ = headerAttributes.namedItem( "Encoding" ).toAttr().value();