QR code with multibyte characters

512 views
Skip to first unread message

entrepreneur pankti

unread,
Apr 11, 2016, 2:31:53 AM4/11/16
to zxing
Jdev 11.1.2.2.0

I have to generate a QR bar-code for my application and for which I have used zxing by google to achieve the same. It is working well when scanned for text, numbers and special characters. But when I give any other language than English and scan the bar-code, it is displaying every character as a question mark.

How do I achieve QR bar-code generation for multi byte characters.

Lachezar Dobrev

unread,
Apr 11, 2016, 5:31:53 AM4/11/16
to entrepreneur pankti, zxing
  What are you using to generate the QR Codes?
  The on-line "QR Code Generator", the command-line interface or probably your own code?
  The command-line one failed to deliver though.



--
You received this message because you are subscribed to the Google Groups "zxing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zxing+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

entrepreneur pankti

unread,
Apr 11, 2016, 6:28:23 AM4/11/16
to zxing

Thanks a lot for your time Sir.

I have followed the below blog for implementing QR code

http://javapapers.com/core-java/java-qr-code/

Lachezar Dobrev

unread,
Apr 11, 2016, 11:41:59 AM4/11/16
to entrepreneur pankti, zxing
  Own code than. OK.
  The demonstrative code is not exactly correct. The encoding is being used weirdly.

  Put the encoding in the encoding hints map:
  hintMap.put(EncodeHintType.CHARACTER_SET, charset);

  And instead of:
    new String(qrCodeData.getBytes(charset), charset)
  just supply the text to be encoded:
    qrCodeData

  The core problem is that QRCode only specifies how to encode a subset of the Japanese Kanji text, and has specific mode for Kanji, all other non-ASCII texts must be encoded in binary mode, but there is no specification as to what encoding should be used when encoding.
  UTF-8 is a common sensible default, but is not mandatory.


entrepreneur pankti

unread,
Apr 11, 2016, 10:21:29 PM4/11/16
to zxing
Thanks sir

I was able to provide qrCodeData instead of that new string statement.

But while tring to replace
hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
with code suggested i.e.
hintMap.put(EncodeHintType.CHARACTER_SET, charset);

I'm getting the error
"put(EncodeHintType,String) cannot invoke put(com.google.zxing.EncodeHintType, com.google.zxing.qrcode.decoder.ErrorCorrectionLevel) in Map"

PFA of screenshot

1.jpg

Lachezar Dobrev

unread,
Apr 12, 2016, 4:38:22 AM4/12/16
to entrepreneur pankti, zxing
  Your hints' Map declaration is wrong.
  Hints is Map<EncodeHintType, Object>.
  You're not supposed to replace the error correction hint, but rather add a new hint.
  May I suggest the collections trail in the Java tutorial [1].

  [1] http://docs.oracle.com/javase/tutorial/collections/index.html

Reply all
Reply to author
Forward
0 new messages