Decode utf8 text only for correct format in Literal.getText()

This commit is contained in:
Tankred Hase 2016-02-06 21:00:38 +07:00
parent 2754bfef54
commit 83fcbaa633

View File

@ -60,7 +60,7 @@ Literal.prototype.setText = function(text) {
*/ */
Literal.prototype.getText = function() { Literal.prototype.getText = function() {
// decode UTF8 // decode UTF8
var text = util.decode_utf8(util.Uint8Array2str(this.data)); var text = this.format === 'utf8' ? util.decode_utf8(util.Uint8Array2str(this.data)) : util.Uint8Array2str(this.data);
// normalize EOL to \n // normalize EOL to \n
return text.replace(/\r\n/g, '\n'); return text.replace(/\r\n/g, '\n');
}; };