Use it library, input Chinese content, generate bar code, with software that sweep the bar code, it is garbled, someone who knows English and Numbers are normal, could you tell me how to solve?
Map Hints=new HashMap<> (a);
Hints. The put (EncodeHintType CHARACTER_SET, CharacterSetECI UTF8);//set the coded character set utf-8
Hints. The put (EncodeHintType MARGIN, MARGIN);
BarcodeFormat format=BarcodeFormat. PDF_417;
//create a matrix object
BitMatrix BitMatrix=null;
Try {
//generate corresponding bit matrix qr code object
BitMatrix=new MultiFormatWriter (.) encode (contents, format, width, height, hints);
} the catch (WriterException e) {
e.printStackTrace();
}
//set a matrix image of parameter
MatrixToImageConfig config=new MatrixToImageConfig (Color. Black. GetRGB (), Color. White. GetRGB ());
//a matrix object BufferedImage objects
BufferedImage qrcode=MatrixToImageWriter. ToBufferedImage (bitMatrix, config);
ImageIO. Write (qrcode, "PNG", the new File (" E:/111 PNG "));