From 7eda9689807f7752f4ba1ce7e1fa7993c7ebcfab Mon Sep 17 00:00:00 2001 From: Piroli YUKARINOMIYA Date: Sun, 11 May 2014 11:10:59 +0900 Subject: [PATCH] Issue ticket #2 Enable multibyte strings in title and body string --- chrome/thunderlink/content/thunderlink.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/chrome/thunderlink/content/thunderlink.js b/chrome/thunderlink/content/thunderlink.js index f42a4ab..a775ab6 100755 --- a/chrome/thunderlink/content/thunderlink.js +++ b/chrome/thunderlink/content/thunderlink.js @@ -25,7 +25,7 @@ var ThunderLinkChromeNS = { dump("CopyMessageUrlToClp mailboxMsgUrl: " + string + "\n"); var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"] .getService(Components.interfaces.nsIClipboardHelper); - clipboard.copyString(string); + clipboard.copyString( ThunderLinkChromeNS.ConvertToUnicode( string )); } catch (ex) { dump("ex="+ex+"\n"); @@ -148,7 +148,7 @@ var ThunderLinkChromeNS = { const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; var item = window.document.createElementNS(XUL_NS, "menuitem"); // create a new XUL menuitem - item.setAttribute("label", label ); + item.setAttribute("label", ThunderLinkChromeNS.ConvertToUnicode( label )); item.setAttribute("oncommand", "ThunderLinkChromeNS.CopyCustomTlStringToClp("+cstrnum+")"); return item; } @@ -168,6 +168,14 @@ var ThunderLinkChromeNS = { } }, + ConvertToUnicode: function( string ) { + var converter = Components + .classes[ "@mozilla.org/intl/scriptableunicodeconverter" ] + .createInstance( Components.interfaces.nsIScriptableUnicodeConverter ); + converter.charset = "UTF-8"; + return converter.ConvertToUnicode( string ); + }, + dumpln: function(msg) { dump(msg + "\n");