fromUtf8 = function(str) {
    str = utf8.encode(str);
    var hex = "";
    for(var i = 0; i < str.length; i++) {
        var code = str.charCodeAt(i);
        if (code === 0)
            break;
        var n = code.toString(16);
        hex += n.length < 2 ? '0' + n : n;
    }

    return "0x" + hex;
}
Should be called to get hex representation (prefixed by 0x) of utf8 string

@method fromUtf8
@param {String} string
@param {Number} optional padding
@returns {String} hex representation of input string