Vieri Di Paola - 2012-12-28

I created a qr code online (eg. http://goqr.me/) and created a UTF-8 encoded QR code with the text "L'étoile".
I scanned it with the Zbar sample Android application (CameraTest activity) and got an incorrect display of the encoded text (the "é" character is not displayed correctly).
I don't fully grasp the character encoding logic but I think that the default charset in Android is UTF-8 and that if the QR code is UTF-8 encoded then Zbar should be able to display the string correctly.
Note that the above web site can also encode in  ISO-8859-1.

So I slightly modified the following code from CameraTestActivity.java:

    
PreviewCallback previewCb = new PreviewCallback() {
            public void onPreviewFrame(byte[] data, Camera camera) {
                Camera.Parameters parameters = camera.getParameters();
                Size size = parameters.getPreviewSize();
                Image barcode = new Image(size.width, size.height, "Y800");
                barcode.setData(data);
                int result = scanner.scanImage(barcode);
                
                if (result != 0) {
                    previewing = false;
                    mCamera.setPreviewCallback(null);
                    mCamera.stopPreview();
                    
                    SymbolSet syms = scanner.getResults();
                    for (Symbol sym : syms) {
                        try {
                            byte[] bytes = sym.getDataBytes();
                            String decodedResult = new String(bytes, "ISO-8859-1");
                            scanText.setText("barcode result " + sym.getData() + " Decoded barcode result " + decodedResult);
                        } catch(UnsupportedEncodingException uee) {
                            scanText.setText(uee.getMessage());
                        }
                        barcodeScanned = true;
                    }
                }
            }
        };

I still get an incorrect display.

Also, if I encode the QR code online with ISO-8859-1 and change the above Android code to

String decodedResult = new String(bytes, "UTF-8");

I still get an incorrect display/transcription.

What am I doing wrong?
What can I try?

Thanks,

Vieri