QZBarThread.cpp can't decode Shift_JIS
In libzbarqt library, the Qt binding program fails to decode if the decoded characters include codes in a multi-byte character set such as Shift_JIS. (libzbarqt is available in package libzbarqt-dev on Ubuntu) It happens because the following function image_callback in QZbarThread.cpp cannot handle the case:
@void QZBarThread::image_callback (Image &image)
for(Image::SymbolIterator sym = image.symbol_begin();
sym != image.symbol_end();
QString data = QString::fromStdString(sym->get_data());
emit decoded(sym->get_type(), data);
emit decodedText(textFormat.arg( QString::fromStdString(sym->get_type_name()), QString::fromStdString(sym->get_addon_name()), data)); }
To cope with the problem, I'd like to change
@ QString data = QString::fromStdString(sym->get_data());@
to something like
@ QByteArray data = sym->get_data());@
so that the byte array is received, which will be decoded into Unicode by detecting its character set (such as Shift_JIS). To do it, the scheme I posted in "TextPreview":http://qt-project.org/wiki/TextPreview utililzing the library libuchardet can be useful. There'll be subsequent changes in the headers, etc. as well.
While I'm going to try the above chage to the libzbarqt library source and compile it, I'd like to know if the above approach is a good one or there is a better one.