var str = '刘德华';str = str.replace(/[\s\S]/g, function(m){return '\\u' + ('000' + m.charCodeAt().toString(16)).slice(-4);});console.log(str);