summaryrefslogtreecommitdiff
path: root/js/matrix.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/matrix.js')
-rw-r--r--js/matrix.js20
1 files changed, 3 insertions, 17 deletions
diff --git a/js/matrix.js b/js/matrix.js
index b6fb765..5c56bd4 100644
--- a/js/matrix.js
+++ b/js/matrix.js
@@ -258,22 +258,8 @@ Matrix.prototype.irssi = function(){
.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]
- }
- }
+
+ var escaped_txt = unicode.escapeToEscapedBytes(txt)
+
return '/exec -out printf "%b" "' + escaped_txt + '"\n'
}