PHP decoding html encoded characters [duplicate] - php

This question already has answers here:
URL Decoding in PHP
(6 answers)
Closed 6 years ago.
I have problem decoding html encoded character using php, what should i do?
Below is the sample input.
%D8%A7%D8%AB%D8%A7%D8%B1%D9%87 %D8%A7%D9%84%D9%85%D8%B1%D9%87
Below is the sample output i want.
اثاره المره

Use PHP's urldecode function:
urldecode("%D8%A7%D8%AB%D8%A7%D8%B1%D9%87 %D8%A7%D9%84%D9%85%D8%B1%D9%87");

Related

pluses are getting stripped from GET variable in php [duplicate]

This question already has answers here:
PHP - Plus sign with GET query
(6 answers)
When should space be encoded to plus (+) or %20? [duplicate]
(5 answers)
Closed 3 years ago.
First of all thanks in advance to everyone helping me out with my question.
I've got a base64_encoded string that looks like:
$_GET['val']='8AH1Oc+gqwjMPyyAL+PIu2neFF5C+bQAkDf/FJdApT4AC09jD/o9I3vHs0cIPC8678TzuFMVlZd+7zA/fV1b9OEF0Uwnao3aURtGUkbx4NoEQFvQ1hBPy0EbUobbRQO/WojW9F6oowS/yX+I+qj53N4nORxhKJRDzMIQO1W8sOSH1BkBHsCotG1dj813OWLoBLy+K9ABLBqUta9+0Mk3JCg+wO/WA2Bh06M0n4ux+qk=';
but when im trying to get the same variable to decode it i recieve it with pluses removed:
$string=$_GET['val'];
echo $string; // either echo $_GET['val']; output will be '8AH1Oc gqwjMPyyAL PIu2neFF5C bQAkDf/FJdApT4AC09jD/o9I3vHs0cIPC8678TzuFMVlZd 7zA/fV1b9OEF0Uwnao3aURtGUkbx4NoEQFvQ1hBPy0EbUobbRQO/WojW9F6oowS/yX I qj53N4nORxhKJRDzMIQO1W8sOSH1BkBHsCotG1dj813OWLoBLy K9ABLBqUta9 0Mk3JCg wO/WA2Bh06M0n4ux qk='
Could somebody please explain why does it happen?

How get the decoded contents sent to php server? [duplicate]

This question already has an answer here:
decoding eval(base64_decode))
(1 answer)
Closed 3 years ago.
I have the following encoded codes! It will decode itself and run with eval() function, is any solution to get the decoded codes that run by server?!
<?php /*** PHP Encode v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4qBjdN37tr2UQpkvCD1oxKtVm3Wuv58oPgN8GPdLW4uqj5bcZ4Zh01jtSdEKuHMh81id6nPKpVHyvzaihkMpo8PnRR8pJKCcKOZ1vF5WvzRb7wWcconSH80hgCusDfAVIHFoXAfF5U8zGEvtvHeZH4K1AqnPsZigJyl9Y+7h0c/DIYjUY4lHirN53n0qUv3k+lhaLMi+EKl0H0tsK68XRl1I4gLxXCn7tBSPvyNsAYZbLmTfwD
Have you tried to do this:
echo base64_decode("aWYoIWZ1bmN0aW9uX2V4aXN0cygi ...
?
You should see the encoded code.

How to decode Ascii code in a Character in PHP [duplicate]

This question already has answers here:
URL Decoding in PHP
(6 answers)
Closed 6 years ago.
I got the string in this format
solr/?key=color&facet=Blue%26keyword%3Dwoo
However, I want to get it in this format
solr/?key=color&facet=Blue&keyword=woo
Try urldecode:
$url = urldecode("solr/?key=color&facet=Blue%26keyword%3Dwoo");
// = solr/?key=color&facet=Blue&keyword=woo

Creating a URL (HTTP Query) with PHP without escaping special charaters [duplicate]

This question already has answers here:
http_build_query() without url encoding
(10 answers)
Closed 6 years ago.
I want this:
datasetid=GHCND&locationid=ZIP:28801&startdate=2010-05-01&enddate=2010-05-01
I have this:
$data=['datasetid'=>'GHCND','locationid'=>'ZIP:28801','startdate'=>'2010-05-01','enddate'=>'2010-05-01'];
I tried this:
exit(http_build_query($data));
I got this:
datasetid=GHCND&locationid=ZIP%3A28801&startdate=2010-05-01&enddate=2010-05-01
How can I prevent ZIP:28801 from being escaped as ZIP%3A28801?
You need to urldecode the string like this:
urldecode(http_build_query($data));

Encoding converting PHP [duplicate]

This question already has an answer here:
Encoding detecting php
(1 answer)
Closed 8 years ago.
I need help with encoding :(
I have parsed string from site: Ëè÷íûå âñòðå÷è
My site is in UTF-8 encoding.
How to convert parsed string to encoding of my site?
On this site artlebedev.ru/tools/decoder
When I click on "Расшифровать" button, I get right result: Личные встречи.
this does not work you say?
echo iconv("iso-8859-5","utf-8","Ëè÷íûå âñòðå÷è");
then are you sure your file is utf8 also?
try this
echo iconv("cp1251","utf8",iconv("utf8","cp1252","Ëè÷íûå âñòðå÷è"));

Categories