fix: dsl ann file codec detection

This commit is contained in:
xiaoyifang 2024-11-22 11:35:22 +08:00
parent 482e696847
commit 8d4eeb581f

View file

@ -50,9 +50,10 @@ QString unescapeAmps( QString const & str )
QTextCodec::Encoding detectCodec( QByteArray & ba, char16_t expectedFirstCharacter = 0 )
{
QStringConverter::Encoding detectedEncoding = QStringConverter::encodingForData( data, expectedFirstCharacter );
QStringConverter::Encoding detectedEncoding = detectEncoding( ba, expectedFirstCharacter );
// mapping the encoding
if ( detectedEncoding.has_value() && encodingMap.contains( detectedEncoding.value() ) ) {
if (encodingMap.contains( detectedEncoding ) )
{
return encodingMap[ encoding ];
}
// default utf8
@ -62,7 +63,6 @@ QTextCodec::Encoding detectCodec( QByteArray & ba, char16_t expectedFirstCharact
QStringConverter::Encoding detectEncoding( QByteArray & ba, char16_t expectedFirstCharacter = 0 )
{
QStringConverter::Encoding detectedEncoding = QStringConverter::encodingForData( data, expectedFirstCharacter );
// mapping the encoding
if ( detectedEncoding.has_value() ) {
return detectedEncoding.value();
}