Don't go and implement the UTF-8 encoding and decoding yourself, as you can still use built in functionality:
var utf8 = {
encode: function(s){return unescape(encodeURIComponent(s));},
decode: function(s){return decodeURIComponent(escape(s));}
};
My family, books, photos, technology, language and some math משפחתי, ספרים, תמונות, טכנולוגיה, שפה, וקצת מתמטיקה
var utf8 = {
encode: function(s){return unescape(encodeURIComponent(s));},
decode: function(s){return decodeURIComponent(escape(s));}
};