mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #955 from natcl/master
Fix escapce character catch in TCPGet + support 0x?? sequences
This commit is contained in:
commit
4c9d7cbeed
@ -394,8 +394,18 @@ module.exports = function(RED) {
|
|||||||
|
|
||||||
if (this.out != "char") { this.splitc = Number(this.splitc); }
|
if (this.out != "char") { this.splitc = Number(this.splitc); }
|
||||||
else {
|
else {
|
||||||
this.splitc = this.splitc.replace("\\n",0x0A).replace("\\r",0x0D).replace("\\t",0x09).replace("\\e",0x1B).replace("\\f",0x0C).replace("\\0",0x00);
|
if (this.splitc[0] == '\\') {
|
||||||
if (typeof this.splitc == "string") { this.splitc = this.splitc.charCodeAt(0); }
|
this.splitc = parseInt(this.splitc.replace("\\n",0x0A).replace("\\r",0x0D).replace("\\t",0x09).replace("\\e",0x1B).replace("\\f",0x0C).replace("\\0",0x00));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof this.splitc == "string") {
|
||||||
|
if (this.splitc.substr(0,2) == "0x") {
|
||||||
|
this.splitc = parseInt(this.splitc);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.splitc = this.splitc.charCodeAt(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // jshint ignore:line
|
} // jshint ignore:line
|
||||||
|
|
||||||
var buf;
|
var buf;
|
||||||
|
Loading…
Reference in New Issue
Block a user