Unicode <=> UTF-8
var _to_utf8 = function(s) { return unescape(encodeURIComponent(s)); }; var _from_utf8 = function(s) { return decodeURIComponent(escape(s)); }; String.prototype.to_utf8 = function() { return _to_utf8(this); }; String.prototype.from_utf8 = function() { return _from_utf8(this); };
以前に書いたコードを encodeURIComponent, decodeURIComponent を使って書き直しました。

