Is UTF-8 the encoding of choice for QR-codes with non ASCII chars by now?

∥☆過路亽.° 提交于 2019-12-12 12:04:20

问题


Google uses UTF-8 it as default for their very popular encoder. From what I can see they don't even add the byte order mark.

The problem is that most scanners still seem to use JIS8 (QR 2000) instead of iso-8859 (QR 2005) as default, so it mostly does not work to use iso-8859 for encoding.

It seems like utf-8 is the only choice even if it is against the specification.

edit: I will go with utf-8 without ECI and without BOM. Against all spec and spirit but works best at the moment.


回答1:


The specification says that ISO-8859-1 is the default for byte-mode encoding. However in practice, yes, you'll see a lot of Shift-JIS in Japan, or UTF-8.

UTF-8 is the right choice. To do it properly, you need to put some indication in the stream that it's UTF-8. The spec does allow for this. You need to precede the byte segment with an ECI segment that indicates UTF-8.

The zxing encoder will do that for you if you send it a hint that the encoding is UTF-8.



来源:https://stackoverflow.com/questions/9699657/is-utf-8-the-encoding-of-choice-for-qr-codes-with-non-ascii-chars-by-now

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!