@BarcodeEncoder: translate the URL persentage encoded special character to the corresponding UTF8 code before encoding to QR Code. #134

This commit is contained in:
Nikos Ftylitakis 2020-01-13 11:27:31 +02:00
parent 1082c3b9e5
commit c1f4379ec7
3 changed files with 12 additions and 4 deletions

View File

@ -31,11 +31,19 @@ ApplicationWindow {
fill: parent
margins: 10
}
TextField {
TextArea {
id: inputField
Layout.fillWidth: true
selectByMouse: true
text: "Hello world!"
Rectangle{
anchors.fill: parent
border.color: "#656565"
border.width: 1
color: "transparent"
}
}
Row {

View File

@ -595,13 +595,15 @@ QImage QZXing::encodeData(const QString &data, const QZXingEncoderConfig &encode
{
QImage image;
QString dataTemp(QUrl::fromPercentEncoding(data.toUtf8()));
try {
switch (encoderConfig.format) {
#ifdef ENABLE_ENCODER_QR_CODE
case EncoderFormat_QR_CODE:
{
Ref<qrcode::QRCode> barcode = qrcode::Encoder::encode(
data.toStdWString(),
dataTemp.toStdWString(),
encoderConfig.errorCorrectionLevel == EncodeErrorCorrectionLevel_H ?
qrcode::ErrorCorrectionLevel::H :
(encoderConfig.errorCorrectionLevel == EncodeErrorCorrectionLevel_Q ?

View File

@ -87,8 +87,6 @@ Ref<QRCode> Encoder::encode(const std::wstring& content, ErrorCorrectionLevel &e
version = recommendVersion(ecLevel, mode, headerBits, dataBits);
}
qDebug() << version->getVersionNumber() << ": " << content.size();
BitArray headerAndDataBits;
headerAndDataBits.appendBitArray(headerBits);
// Find "length" of main segment and write it