summaryrefslogtreecommitdiff
path: root/js/matrix.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/matrix.js')
-rw-r--r--js/matrix.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/js/matrix.js b/js/matrix.js
index 98c132d..9809865 100644
--- a/js/matrix.js
+++ b/js/matrix.js
@@ -122,7 +122,7 @@ Matrix.prototype.mirc = function () {
Matrix.prototype.irssi = function(){
var txt = this.mirc()
.replace(/\%/g, '%%')
- .replace(/\\/g, '\\\\')
+ .replace(/\\/g, '\\x5C')
.replace(/\"/g, '\\\"')
.replace(/\'/g, '\\\'')
.replace(/\`/g, '\\\`')
@@ -130,9 +130,29 @@ Matrix.prototype.irssi = function(){
.replace(/\s+$/g, '\n')
.replace(/^\n+/, '')
.replace(/\n/g, '\\n')
- .replace(/\x03/g, '\\x03');
+ .replace(/\x02/g, '\\x02')
+ .replace(/\x03/g, '\\x03')
+console.log(txt.length)
+ var escaped_txt = "", kode
+ for (var i = 0; i < txt.length; i++) {
+ kode = txt.charCodeAt(i)
+ if (kode > 0x7f) {
+ kode = kode.toString(16)
+ switch (kode.length) {
+ case 2:
+ kode = "0" + kode
+ case 3:
+ kode = "0" + kode
+ }
+ escaped_txt += "\\u" + kode
+ }
+ else {
+ escaped_txt += txt[i]
+ }
+ }
+ // .replace(/\x03/g, '\\x03');
// console.log(txt)
- return '/exec -out printf "' + txt + '"\n'
+ return '/exec -out printf "' + escaped_txt + '"\n'
}
Matrix.prototype.expand = function(i){
var w = this.w = clamp(this.w+i, 1, 9), h = this.h = clamp(this.h+i, 1, 9)