kopia lustrzana https://github.com/backface/turtlestitch
Merge pull request #2931 from jmoenig/michael/utf-8
Better Support Multi-Byte Emoji with `split` and `unicode`snap7
commit
4210201e07
|
@ -932,7 +932,7 @@ List.prototype.asCSV = function () {
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
cell = ['\"'];
|
cell = ['\"'];
|
||||||
string.split('').forEach(letter => {
|
Array.from(string).forEach(letter => {
|
||||||
cell.push(letter);
|
cell.push(letter);
|
||||||
if (letter === '\"') {
|
if (letter === '\"') {
|
||||||
cell.push(letter);
|
cell.push(letter);
|
||||||
|
|
|
@ -4344,15 +4344,16 @@ Process.prototype.reportStringSize = function (data) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Process.prototype.reportUnicode = function (string) {
|
Process.prototype.reportUnicode = function (string) {
|
||||||
var str;
|
var str, unicodeList;
|
||||||
|
|
||||||
if (this.enableHyperOps) {
|
if (this.enableHyperOps) {
|
||||||
if (string instanceof List) {
|
if (string instanceof List) {
|
||||||
return string.map(each => this.reportUnicode(each));
|
return string.map(each => this.reportUnicode(each));
|
||||||
}
|
}
|
||||||
str = isNil(string) ? '\u0000' : string.toString();
|
str = isNil(string) ? '\u0000' : string.toString();
|
||||||
if (str.length > 1) {
|
unicodeList = Array.from(str);
|
||||||
return this.reportUnicode(new List(str.split('')));
|
if (unicodeList.length > 1) {
|
||||||
|
return this.reportUnicode(new List(unicodeList));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
str = isNil(string) ? '\u0000' : string.toString();
|
str = isNil(string) ? '\u0000' : string.toString();
|
||||||
|
@ -4420,9 +4421,10 @@ Process.prototype.reportBasicTextSplit = function (string, delimiter) {
|
||||||
str = str.trim();
|
str = str.trim();
|
||||||
del = /\s+/;
|
del = /\s+/;
|
||||||
break;
|
break;
|
||||||
|
case isNil(delimiter):
|
||||||
|
case '':
|
||||||
case 'letter':
|
case 'letter':
|
||||||
del = '';
|
return new List(Array.from(str));
|
||||||
break;
|
|
||||||
case 'csv':
|
case 'csv':
|
||||||
return this.parseCSV(string);
|
return this.parseCSV(string);
|
||||||
case 'json':
|
case 'json':
|
||||||
|
@ -4434,7 +4436,7 @@ Process.prototype.reportBasicTextSplit = function (string, delimiter) {
|
||||||
return this.parseCSVfields(string);
|
return this.parseCSVfields(string);
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
del = isNil(delimiter) ? '' : delimiter.toString();
|
del = delimiter.toString();
|
||||||
}
|
}
|
||||||
return new List(str.split(del));
|
return new List(str.split(del));
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue