Posted
almost 13 years
ago
by
Balázs Németh
This does not support non-ascii characters.
E. g.:
árvíztűrő -encode-> =C3=A1rv=C3=ADzt=C5=B1r=C5=91 -this-decoder-> árvÃztűrÅ
|
Posted
almost 13 years
ago
by
hieshibre
|
Posted
almost 13 years
ago
by
Weldan Jamili
//Require file_get_contents.js
function is_readable(file) {
var _file = file_get_contents(file);
if (_file) {
var _length1 = _file.replace("<h1>Object not found!</h1>", "LOL", _file);
var _length2 = _file;
... [More]
if (_length1.length === _length2.length) {
return true;
}
return false;
}
}
[Less]
|
Posted
almost 13 years
ago
by
deepak
deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu deepak sahu
|
Posted
almost 13 years
ago
by
legatee322
|
Posted
almost 13 years
ago
by
Bored
Nice share info.Thanks you..!
|
Posted
almost 13 years
ago
by
Marek Spak
or you could just use join on the array. like this
['hello','world','!!!'].join(' ') //return "hello world !!!"
or am i missing something?
|
Posted
almost 13 years
ago
by
Rick K
So I'm not really sure whats going on here, but I'm having a problem with this function. When I use PHP's serialize on a string value of "7½" (imagine the html entity here is the actual 1/2 fraction character and not the html entity code (not sure if
... [More]
it will render or not at time of posting)) The php parser will return a string value 2 bytes long. When I do the same via JS and this function, I get a string value 3 bytes long with a hidden  character between 7 and the 1/2 fraction. Why is this? I've tried everything to get around it. What I ended up having to do was in php, after it receives the serialized version of the string, it unserializes it, then it runs it through a recursive function that essentially converts all special characters to their &entityName; code, then I str_ireplace("Â", "", $curval); then I reencode the value by converting all &entities; back to ther actual character code. Then I re-serialize using php's serialize function and then store it to the database. Case and point when I reserialized this via PHP with the 1/2 fraction characater (as a character) in the string, it stores it correctly as a 2 byte string and does not add the funky acric character back in. This was the ONLY way I could get this function to work. I know the Acirc character has something to do with character encoding but the site is set to use western/latin, not UTF8. Is there some way via javascript I can convert the UTF8 version of the value to the latin version before I use your serialize function?
And why does this function not work exactly like the PHP version? I thought that was the point of this project? Is this a bug?
Here is your functions version:
a:1:{i:0;a:7:{s:3:"sku";s:5:"1052m";s:4:"name";s:21:"Boonie Hat (ABU Camo)";s:5:"price";s:5:"17.99";s:3:"qty";s:1:"1";s:6:"typeid";s:1:"3";s:6:"status";s:3:"new";s:2:"ui";a:1:{i:0;a:2:{s:4:"name";s:4:"size";s:5:"value";s:3:"7½";}}}}
(notice s:3: on the last value of the last array)
Here is PHP's version:
a:1:{i:0;a:7:{s:3:"sku";s:5:"1052m";s:4:"name";s:21:"Boonie Hat (ABU Camo)";s:5:"price";s:5:"17.99";s:3:"qty";d:1;s:6:"typeid";s:1:"3";s:6:"status";s:3:"new";s:2:"ui";a:1:{i:0;a:2:{s:4:"name";s:4:"size";s:5:"value";s:2:"7½";}}}
(notice s:2: on the last value of the last array)
[Less]
|
Posted
almost 13 years
ago
by
Yepi
Thanks for giving me the useful information. I think I need it. Thank you
|
Posted
almost 13 years
ago
by
Evelus
Fantastic, thanks! Been trying to figure out the best way to slice clientside.
|