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

Problem German Umlaute #43

Closed
jhillmannco opened this issue Jul 7, 2016 · 5 comments
Closed

Problem German Umlaute #43

jhillmannco opened this issue Jul 7, 2016 · 5 comments

Comments

@jhillmannco
Copy link

Problem with
123456789äüß will return
123456789???
But
Ä123456789äüß returns
Right

Please correct

@codebude
Copy link
Owner

codebude commented Jul 7, 2016

Hello @jhillmannco ,

this isn't really a bug by QRCoder but rather a bug by yours and some other QRCode readers. QRCoder generates valid QR codes. Just try the QR code in the following QR decoder and you'll see that everything is fine:http://qrlogo.kaarposoft.dk/qrdecode.html

How it has to be done

The problem's source lies in the QR code standard (ISO/IEC 18004). There you can read in chapter 5:

"[...] byte data (default: ISO/IEC 8859-1; or other sets as otherwise defined (see 6.3.4));"

and in chapter 6.3.4

"In closed-system national or application-specific implementations of QR Code 2005, an alternative 8-bit character set, for example as defined in an appropriate part of ISO/IEC 8859, may be specified for Byte mode. When an alternative character set is specified, however, the parties intending to read the QR Code 2005 symbols require to be notified of the applicable character set in the application specification or by bilateral agreement."

What QRCoder does

So this is exactly what QRCoder does. If a payload has to be encoded in Byte-Mode, QRCoder checks if the string can be encoded in ISO-8859-1. If so, it uses ISO-8859-1 encoding, because of the QR code ISO standard. If the payload for example contains asian characters, which can't be encoded in ISO-8859-1, it automatically switches to Utf-8.

What your QR code app does

Your QRCode app doesn't show the umlauts. In most cases this happens, when QR code readers expect Utf-8 in every case. Hardly spoken, this is the result when somebody implements an app which doesn't observes the standard.

How I "solved" it

To help you with your trouble, I added an additional parameter on the CreateQrCode-method in QRCodeGenerator-class with this commit: e473610 .
So by setting the parameter "forceUtf8" to true, you can tell the QRCoder to encode Byte-mode payloads in Utf8 anytime. Thereby your non-standard QR code reader should be able to read the code.

But please take note, that you're leaving the standard path, too, by setting this parameter. Also most QRCode readers should be able to handle this mode, because Utf-8 encoded payloads are marked as such, so most readers should be able to detect the forced Utf-8.

@jhillmannco
Copy link
Author

Perfect Solution !

@jhillmannco
Copy link
Author

Very Good Library now im gonna replace Fuckuchi LibQrencode with this awesome QRCoder

@codebude
Copy link
Owner

codebude commented Jul 7, 2016

May I ask you, in what project you use the library? If you don't want, no problem, but I'm always interested to see where and how it helps other developers.

@jhillmannco
Copy link
Author

jhillmannco commented Jul 7, 2016

Hello
i use it for an Application to generate an Girocode so that Invoices can be paid by an Android App

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

No branches or pull requests

2 participants