I need to remove white spaces from a base64 encoded file . When Base64 gets POSTed, and I got more white spaces in out put string.Where did these white spaces are coming
How do I remove these whitespcaes
I need to remove white spaces from a base64 encoded file . When Base64 gets POSTed, and I got more white spaces in out put string.Where did these white spaces are coming
How do I remove these whitespcaes
When Base64 gets POSTed, all pluses(+) are parsed as spaces. So I used str_replace to convert the spaces back to pluses. This saved my time
If you post a string, depending on how you encoded the POST message, the content of the POST message will be encoded (this might be URLencoded, which is the default in most cases) or HTML encoded.
If your POST message contains a +
character where there should have been a space, this means it is being URL-Encoded.
If your POST message contains %20
where there should have been a space, this means it is being HTML-encoded.
PHP offers methods to revert these encoded strings back to the ones they should have been.
urldecode
(PHP4 and PHP5) documentation can be found here
html_entity_decode
(PHP 4.3.0+ and PHP5) documentation can be found here