# BarcodeRecognize can read Chinese,but why BarcodeImage can't make Chinese characters to QR image?

For example:

Import["http://www.image-share.com/upload/2735/230.jpg"]
BarcodeRecognize@%


can give a String "别看我，我会害羞..." but if I go on using BarcodeImage on the output:

BarcodeImage@%


It will throw a warning:

BarcodeImage called with 1 argument; 2 or 3 arguments are expected.

So how could I use BarcodeImage to make Chinese characters to QR image?

• The bug has been repaired in 10.3 – yode Dec 30 '15 at 16:26

The problem seems to be a mixture of three things

1. You didn't put all the necessary arguments for BarcodeImage
2. BarcodeImage is limited on text encoding (against standards)
3. The documentation is poor and does not describe the existing limitation

## The good

img = Import["http://www.image-share.com/upload/2735/230.jpg"];
str = BarcodeRecognize@img


"别看我，我会害羞..."

Or as an image for poorly configured devices

So far so good

Now BarcodeImage needs to be called with two arguments, as the error you got explained.

Then do:

BarcodeImage["text", "QR"]


But not

The second arguments can be any of these:

1D: "UPC", "EAN8", "EAN13", "Code39", "Code128", "ITF", "Codabar"

2D: "Aztec", "DataMatrix", "QR", "PDF417"

## The ugly

We get an error even for proper use, and the clue is in the error message

BarcodeImage[str, "QR"]


BarcodeImage::qr: Expecting a string of characters defined in ISO/IEC 8859-1 of length up to 2953, a string of alphanumeric characters of length 4296, or a string of digits of length up to 7089 instead of 别看我，我会害羞.... >>

I guess Chinese characters are not encoded in ISO/IEC 8859-1.

Shamefully the documentation says nothing about encoding limitations. This is very unfortunate implementation from Mathematica, QR codes are supposed to accept various encodings .

## Workaround

Wolfram alpha doesn't seem to have that limitation

WolframAlpha["QR code \"别看我，我会害羞...\""]


So you can get a clean output by

chineseQR[str_String] :=  WolframAlpha["QR code \"" <> str <> "\"", {{"QRCodeBarcode", 1}, "Content"}]


And for future use:

chineseQR[str]


• oh,Just had the same idea with you when I reopen the browser.I think this is a good idea.just as an old saying goes:心有灵犀一点通. – partida Oct 24 '14 at 8:49
• @user15961, Probably you could write to Wolfram Technical Support requesting full implementation in future releases. In Mathematica > Help > Give Feedback... – rhermans Oct 24 '14 at 9:36
• Yeah,I will feedback this problem to them. – partida Oct 24 '14 at 9:38

yes, we can do this way:

 barcodeImage[x_String] :=ImageCrop@Image@Rasterize@WolframAlpha["QR code:" <> x,{{"QRCodeBarcode", 1}, "Content"}];


and then

barcodeImage@"中文"
BarcodeRecognize@%(*Chinese*)


will return the result!