swico / www.swiss-qr-invoice.org

Website for Swiss QR Invoice organization.
https://www.swiss-qr-invoice.org
11 stars 1 forks source link

Backslash in QR Code #35

Open watuwo opened 2 years ago

watuwo commented 2 years ago

There is some confusion about how to encode backslashes (U+005C) in QR Codes.

In most of our tests of the generators from https://www.paymentstandards.ch/de/home/readiness/generators.html ECI mode (bits: 0111) with UTF-8 (bits: 00011010) was used in the generated QR Code. We see that backslashes (e.g. entered through a "Name" field) are not doubled even though ISO 18004 says:

Where 5C[_]HEX appears as true data it shall be doubled in the data string before encoding in symbols to which the ECI protocol applies.

None of QR Code reader apps and websites we tried would undouble doubled backslashes. Clarifications would be much appreciated.

Note: We inspected the bytes reported by https://zxing.org/w/decode.jspx for the generated QR Codes.

epsitec commented 2 years ago

@watuwo -- thank you for bringing this topic to the attention of our fellow developers.

The people who designed the QR-bill specification at SIX did not take into account the proper (low-level) encoding of the payload in the QR-Code. At the end of the design phase, when I got involved in a joint SIX-SWICO working group, I insisted that symbol encoding and a proper ECI protocol should be specified (22 March 2018).

Alas, the topic was not understood (well enough) by the people in charge of the specification, and my requests were ignored.

We have to live with the fact that most QR codes treat their payload just as a binary blob, containing an UTF-8 encoded string.

epsitec commented 2 years ago

Moral of the story: ignore ISO 18004 and don't double 0x5C characters.