Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decoding umlauts #14

Closed
hvbargen opened this issue Mar 3, 2018 · 1 comment
Closed

Decoding umlauts #14

hvbargen opened this issue Mar 3, 2018 · 1 comment

Comments

@hvbargen
Copy link

hvbargen commented Mar 3, 2018

The zbar library obviously has problems with data containing non-ascii symbols, eg. german umlauts (ä ö ü).

I tried to decode the longer text from the QR-Code at https://de.wikipedia.org/wiki/QR-Code.

The result is:
b'Wikipedia ist ein Projekt zum Aufbau einer Enzyklop\xef\xbe\x83\xef\xbd\xa4die aus freien Inhalten in \xef\xbe\x83\xef\xbd\xbcber 270 Sprachen, zu dem du mit deinem Wissen beitragen kannst.'

This should be "Enzyklopädie" and "in über 270 Sprache".

Trying to decode with utf-8, this gives:

'Wikipedia ist ein Projekt zum Aufbau einer Enzyklopテ、die aus freien Inhalten in テシber 270 Sprachen, zu dem du mit deinem Wissen beitragen kannst.'

This does the trick: decode with utf-8, encode with shift-jis, and then decode with utf-8 again:

data.decode("utf-8").encode("shift-jis").decode("utf-8")
'Wikipedia ist ein Projekt zum Aufbau einer Enzyklopädie aus freien Inhalten in über 270 Sprachen, zu dem du mit deinem Wissen beitragen kannst.'

I thought I'll add this as an issue to help others.

@quicklizard99
Copy link
Member

Interesting. Thanks for the information. Some more reading about this:

I will close this issue as the behaviour is out of pyzbar's control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants