Commit 77005b25 authored by Frédéric Brière's avatar Frédéric Brière
Browse files

radselect: Correctly parse modern versions of radkfile

Ever since the release of xjdic version 24 (back in 2003), some radkfile
entries have included an additional element (either in the form of a JIS
X 0212 hex code or an image filename), which must be excluded when
parsing the stroke count.
parent 734a6b19
......@@ -10,6 +10,7 @@
#include "radicalfile.h"
#include <QFile>
#include <QRegExp>
#include <QString>
#include <QTextCodec>
#include <QTextStream>
......@@ -79,8 +80,9 @@ bool RadicalFile::loadRadicalFile( QString &radkfile )
m_radicals.insert( *newestRadical, *newestRadical );
}
delete newestRadical;
newestRadical = new Radical( QString( line.at( 2 ) )
, line.rightRef( 2 ).toUInt() );
QStringList lineElements = line.split( QRegExp( QStringLiteral( "\\s+" ) ) );
newestRadical = new Radical( lineElements.at( 1 )
, lineElements.at( 2 ).toUInt() );
}
else if( newestRadical != nullptr )
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment