mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
fix: dsl ann file codec detection
This commit is contained in:
parent
482e696847
commit
8d4eeb581f
|
@ -50,9 +50,10 @@ QString unescapeAmps( QString const & str )
|
||||||
|
|
||||||
QTextCodec::Encoding detectCodec( QByteArray & ba, char16_t expectedFirstCharacter = 0 )
|
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
|
// mapping the encoding
|
||||||
if ( detectedEncoding.has_value() && encodingMap.contains( detectedEncoding.value() ) ) {
|
if (encodingMap.contains( detectedEncoding ) )
|
||||||
|
{
|
||||||
return encodingMap[ encoding ];
|
return encodingMap[ encoding ];
|
||||||
}
|
}
|
||||||
// default utf8
|
// 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 detectEncoding( QByteArray & ba, char16_t expectedFirstCharacter = 0 )
|
||||||
{
|
{
|
||||||
QStringConverter::Encoding detectedEncoding = QStringConverter::encodingForData( data, expectedFirstCharacter );
|
QStringConverter::Encoding detectedEncoding = QStringConverter::encodingForData( data, expectedFirstCharacter );
|
||||||
// mapping the encoding
|
|
||||||
if ( detectedEncoding.has_value() ) {
|
if ( detectedEncoding.has_value() ) {
|
||||||
return detectedEncoding.value();
|
return detectedEncoding.value();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue