mirror of https://github.com/status-im/web3.js.git
removed utf8 support, do not use "escape" && "unescape"
This commit is contained in:
parent
d4a729b73b
commit
9b005e4473
|
@ -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);
|
||||
|
|
|
@ -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' +
|
||||
|
|
|
@ -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' +
|
||||
|
|
Loading…
Reference in New Issue