二维码中的 Unicode 编码和解码问题 [英] Unicode Encoding and decoding issues in QRCode

查看:29
本文介绍了二维码中的 Unicode 编码和解码问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试生成 UTF-8 QRCode,以便我可以重演重音和 Unicode 字符.

I am trying to generate UTF-8 QRCode so that I can encore accents and Unicode characters.

为了测试它,我使用了许多解码解决方案:

To test it, I am using many decoding solution :

  1. http://zxing.org/w/decode.jspx - zxing 项目也在安卓中使用
  2. http://www.drhu.org/QRCode/QRDecoder.php -PHP 解码器
  3. http://zbar.sf.net - ZBar 条码阅读器 - 嵌入式开源和 C 项目
  1. http://zxing.org/w/decode.jspx - The zxing project also used in Android
  2. http://www.drhu.org/QRCode/QRDecoder.php - a PHP Decoder
  3. http://zbar.sf.net - The ZBar bar code reader - OpenSource and C project for embedded

他们给我的结果总是一样的.

All of them give me always the same result.

你可以试试此图像适用于 Unicode 字符.

You can try this image works well with Unicode Characters.

但如果我尝试使用 zxing 或 Google Chart API 生成二维码,则无法正确解码.

But if I am trying to use zxing or Google Chart API to generate the QRCode, I cannot decode it correctly.

我已经试过了:

  1. http://chart.apis.google.com/chart?cht=qr&chs=200x200&choe=SHIFT_JIS&chl=R%C3%A9my+Hubscher
  2. http://chart.apis.google.com/chart?cht=qr&chs=200x200&choe=ISO-8859-1&chl=R%C3%A9my+Hubscher
  3. http://chart.apis.google.com/chart?cht=qr&chs=200x200&choe=UTF-8&chl=R%C3%A9my+Hubscher

但都没有成功.

你知道我该怎么做吗?您知道工作图像使用哪种编码吗?

Do you know how I can do ? Do you know which encoding is used for the working image ?

推荐答案

出现的解决方案是将文本编码为 UTF-8 并添加一个 BOM 以指定字符串实际上是 UTF-8.

The solution that comes up, is to encode the text in UTF-8 and add a BOM to specify that the string is actually in UTF-8.

>

这里有效:

这篇关于二维码中的 Unicode 编码和解码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆