无法正确编码 aztec 代码

Unable to encode aztec codes correctly

我正在尝试在链接到 zxing 解码完全不同的条形码有效负载的 zxing. However, after feeding this into the aztec generator, I am unable to read this payload after scanning the barcode. The reader 的帮助下为 android 应用程序创建具有以下有效负载的 aztec 代码。

还有其他人看到过这个问题吗?还是我错误地生成了 Aztec 代码?

感谢您的帮助

barcode_payload:

i¼\u0000\u0003\u0000\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000)X“}ôZv\u0002ô\u0000\u0000˜\u0012\u0012äNMGX†Ô\u0000\u0001Zv\u0002ô05\u0002\u0018T 64\u0011k\u0007m[\u000f瓉¿RÙƒ¨<úýá‹M\u0002\u0019\u0000 É¼ÏØ\u0010Ë¢\u0003d·ã Í\u000bÚæ? Ÿ#+\u0017˜\u0000

代码:

public static Bitmap createAztec(String str, int mQrWidth, int mQrHeight, String timestampStr) { 
    String aztecStr; 
    if (!TextUtils.isEmpty(timestampStr)) { 
        aztecStr = str + "|" + timestampStr; 
    } else { 
        aztecStr = str; 
    } 
    AztecCode aztecCode = com.google.zxing.aztec.encoder.Encoder.encode(aztecStr.getBytes()); 
    BitMatrix matrix = aztecCode.getMatrix(); 
    if (matrix != null) { 
        int width = matrix.getWidth(); 
        int height = matrix.getHeight(); 
        int[] pixels = new int[width * height]; 
        for (int y = 0; y < height; y++) { 
            int offset = y * width; 
            for (int x = 0; x < width; x++) { 
                pixels[offset + x] = matrix.get(x, y) ? Color.BLACK : Color.WHITE; 
            } 
        } 
        Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); 
        bitmap.setPixels(pixels, 0, width, 0, 0, width, height); 
        return Bitmap.createScaledBitmap(bitmap, mQrWidth, mQrHeight, false); 
    } 
    return null; 
}

解决方案很简单,我不得不使用 ISO-8859-1,ISO 拉丁字母表 1,a.k.a,而不是获取默认的 UTF-8 字符集。 ISO-LATIN-1