|  | 
| 3 | 3 |  *  | 
| 4 | 4 |  * Cross-browser QRCode generator for pure javascript. Support Canvas, SVG and Table drawing methods. Support Dot style, Logo, Background image, Colorful, Title etc. settings. Support Angular, Vue.js, React, Next.js, Svelte framework. Support binary(hex) data mode.(Running with DOM on client side) | 
| 5 | 5 |  *  | 
| 6 |  | - * Version 4.4.6 | 
|  | 6 | + * Version 4.4.7 | 
| 7 | 7 |  *  | 
| 8 | 8 |  * @author [ inthinkcolor@gmail.com ] | 
| 9 | 9 |  *  | 
|  | 
| 45 | 45 | 
 | 
| 46 | 46 |     var QRCode; | 
| 47 | 47 | 
 | 
| 48 |  | -    function QR8bitByte(data, binary) { | 
|  | 48 | +    function QR8bitByte(data, binary, utf8WithoutBOM) { | 
| 49 | 49 |         this.mode = QRMode.MODE_8BIT_BYTE; | 
| 50 | 50 |         this.data = data; | 
| 51 | 51 |         this.parsedData = []; | 
|  | 
| 80 | 80 |         } | 
| 81 | 81 | 
 | 
| 82 | 82 |         this.parsedData = Array.prototype.concat.apply([], this.parsedData); | 
| 83 |  | - | 
| 84 |  | -        if (this.parsedData.length != this.data.length) { | 
|  | 83 | +        if (!utf8WithoutBOM && this.parsedData.length != this.data.length) { | 
| 85 | 84 |             this.parsedData.unshift(191); | 
| 86 | 85 |             this.parsedData.unshift(187); | 
| 87 | 86 |             this.parsedData.unshift(239); | 
|  | 
| 109 | 108 |     } | 
| 110 | 109 | 
 | 
| 111 | 110 |     QRCodeModel.prototype = { | 
| 112 |  | -        addData: function(data, binary) { | 
| 113 |  | -            var newData = new QR8bitByte(data, binary); | 
|  | 111 | +        addData: function(data, binary, utf8WithoutBOM) { | 
|  | 112 | +            var newData = new QR8bitByte(data, binary, utf8WithoutBOM); | 
| 114 | 113 |             this.dataList.push(newData); | 
| 115 | 114 |             this.dataCache = null; | 
| 116 | 115 |         }, | 
|  | 
| 2003 | 2002 |             drawer: 'canvas', // Drawing method: canvas, svg(Chrome, FF, IE9+) | 
| 2004 | 2003 | 
 | 
| 2005 | 2004 |             // ==== CORS | 
| 2006 |  | -            crossOrigin: null // String which specifies the CORS setting to use when retrieving the image. null means that the crossOrigin attribute is not set. | 
|  | 2005 | +            crossOrigin: null, // String which specifies the CORS setting to use when retrieving the image. null means that the crossOrigin attribute is not set. | 
|  | 2006 | + | 
|  | 2007 | +            // UTF-8 without BOM | 
|  | 2008 | +            utf8WithoutBOM: true | 
| 2007 | 2009 |         }; | 
| 2008 | 2010 | 
 | 
| 2009 | 2011 |         if (typeof vOption === 'string') { | 
|  | 
| 2128 | 2130 |     QRCode.prototype.makeCode = function(sText) { | 
| 2129 | 2131 | 
 | 
| 2130 | 2132 |         this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption), this._htOption.correctLevel); | 
| 2131 |  | -        this._oQRCode.addData(sText, this._htOption.binary); | 
|  | 2133 | +        this._oQRCode.addData(sText, this._htOption.binary, this._htOption.utf8WithoutBOM); | 
| 2132 | 2134 |         this._oQRCode.make(); | 
| 2133 | 2135 |         if (this._htOption.tooltip) { | 
| 2134 | 2136 |             this._el.title = sText; | 
|  | 
0 commit comments