Hello,
maybe you can help me a little:
I try to port this class to javascript to exchange the data between php and js but I don't get it.
I guess it has something to do with javascript using utf16?
I tried to use the punnycode.js but without success.
This what I got so far:
cdn.webfan.de/cdn/application/webfa
...
It throws an error: "Invalid code point 123456789...."
If I do not use punnycode.js the unserialized value is always null
var s = require('webfan/serialize/bin');
console.dir(s);
var d = Object.create({
bar : true,
foo : {},
b : 1235456,
c : [1,2,3,4]
});
var enc = s.serialize(d);
enc = utf8_decode(enc.toString());
console.log(enc);
console.dir(s.unserialize(enc));
d = 1235456;
enc = s.serialize(d);
// enc = utf8_decode(enc.toString());
console.log(enc);
console.dir(s.unserialize(enc));
d = 'a string to test';
enc = s.serialize(d);
// enc = utf8_decode(enc.toString());
console.log(enc);
console.dir(s.unserialize(enc));
d = {
bar : true,
foo : {},
b : 1235456,
c : [1,2,3,4]
};
enc = s.serialize(d);
console.log(enc);
console.dir(s.unserialize(enc));
d = 1.5;
enc = s.serialize(d);
// enc = utf8_decode(enc.toString());
console.log(enc);
console.dir(s.unserialize(enc));