Zxing Project is a famous open-source, multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages. But I believe there are somebody have the same problem just like me: I can't Encode UTF-8 characters in a Qrcode.
How do I encode characters using UTF-8 in a QR code using Zxing project?
ZXing.Net is a port of ZXing, an open-source, multi-format 1D/2D barcode image processing library originally implemented in Java. It has been ported by hand with a lot of optimizations and improvements.
ZXing ("zebra crossing") is an open-source, multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages.
The proper way of doing this is using hints:
Hashtable hints = new Hashtable();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
Then call this version of encode
in QRCodeWriter
class:
encode(String contents, BarcodeFormat format, int width, int height,Hashtable hints)
Mister Smith's answer is quite right. But somehow you need to use the lowercase utf-8
instead of uppercase UTF-8
when encoding with ZXing
. Or some scanners such as Alipay cannot read it.
Hashtable hints = new Hashtable();
hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With