removed utf8 support, do not use "escape" && "unescape"

This commit is contained in:
debris 2015-08-10 21:23:56 +02:00
parent d4a729b73b
commit 9b005e4473
3 changed files with 25 additions and 26 deletions

View File

@ -109,7 +109,7 @@ var toAscii = function(hex) {
str += String.fromCharCode(code);
}
return decodeURIComponent(escape(str)); // jshint ignore:line
return str;
};
/**
@ -120,7 +120,6 @@ var toAscii = function(hex) {
* @returns {String} hex representation of input string
*/
var toHexNative = function(str) {
str = unescape(encodeURIComponent(str)); // jshint ignore:line
var hex = "";
for(var i = 0; i < str.length; i++) {
var n = str.charCodeAt(i).toString(16);

View File

@ -200,18 +200,18 @@ describe('lib/solidity/coder', function () {
test({ type: 'string', expected: 'gavofyork', value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000009' +
'6761766f66796f726b0000000000000000000000000000000000000000000000'});
test({ type: 'string', expected: 'ää',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000008' +
'c383c2a4c383c2a4000000000000000000000000000000000000000000000000'});
test({ type: 'string', expected: 'ü',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'c3bc000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'string', expected: 'Ã',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'c383000000000000000000000000000000000000000000000000000000000000'});
//test({ type: 'string', expected: 'ää',
//value: '0000000000000000000000000000000000000000000000000000000000000020' +
//'0000000000000000000000000000000000000000000000000000000000000008' +
//'c383c2a4c383c2a4000000000000000000000000000000000000000000000000'});
//test({ type: 'string', expected: 'ü',
//value: '0000000000000000000000000000000000000000000000000000000000000020' +
//'0000000000000000000000000000000000000000000000000000000000000002' +
//'c3bc000000000000000000000000000000000000000000000000000000000000'});
//test({ type: 'string', expected: 'Ã',
//value: '0000000000000000000000000000000000000000000000000000000000000020' +
//'0000000000000000000000000000000000000000000000000000000000000002' +
//'c383000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'bytes', expected: '0xc3a40000c3a4',
value: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000006' +

View File

@ -119,18 +119,18 @@ describe('lib/solidity/coder', function () {
//'c3a40000c3a40000000000000000000000000000000000000000000000000000',
//expected: 'c3a40000c3a40000000000000000000000000000000000000000000000000000' +
//'c3a40000c3a40000000000000000000000000000000000000000000000000000'});
test({ type: 'string', value: 'ää',
expected: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000008' +
'c383c2a4c383c2a4000000000000000000000000000000000000000000000000'});
test({ type: 'string', value: 'ü',
expected: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'c3bc000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'string', value: 'Ã',
expected: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000002' +
'c383000000000000000000000000000000000000000000000000000000000000'});
//test({ type: 'string', value: 'ää',
//expected: '0000000000000000000000000000000000000000000000000000000000000020' +
//'0000000000000000000000000000000000000000000000000000000000000008' +
//'c383c2a4c383c2a4000000000000000000000000000000000000000000000000'});
//test({ type: 'string', value: 'ü',
//expected: '0000000000000000000000000000000000000000000000000000000000000020' +
//'0000000000000000000000000000000000000000000000000000000000000002' +
//'c3bc000000000000000000000000000000000000000000000000000000000000'});
//test({ type: 'string', value: 'Ã',
//expected: '0000000000000000000000000000000000000000000000000000000000000020' +
//'0000000000000000000000000000000000000000000000000000000000000002' +
//'c383000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'int[]', value: [], expected: '0000000000000000000000000000000000000000000000000000000000000020' +
'0000000000000000000000000000000000000000000000000000000000000000'});
test({ type: 'int[]', value: [3], expected: '0000000000000000000000000000000000000000000000000000000000000020' +