note 125548 added to function.quoted-printable-decode
| From: | jab_creations.yahoo.com via php-notes | Date: | Sat, 28 Nov 2020 08:01:40 +0000 |
| Subject: | note 125548 added to function.quoted-printable-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-215905@lists.php.net to get a copy of this message | ||
If you're getting black diamonds or weird characters that seemingly block an echo but still
encounter strlen($string) > 0 you're probably encountering an encoding issue. Unlike the
people writing ENCODE functions on a DECODE page I will actually talk about DECODE on a DECODE page.
The specific problem I encountered was that an email was encoded using a Russian encoding (KOI8-R)
though I output everything as UTF-8 because: compatibility.
If you try to do this with a Russian encoding:
<?php
echo quoted_printable_decode('=81');
?>
You'll get that corrupted data.
I did a couple of tests and it turns out the following is how you nest the mb_convert_encoding
function:
<?php
echo '<p>Test: "'.mb_convert_encoding(quoted_printable_decode('=81'),
'UTF-8', 'KOI8-R').'".</p>';
?>
Unfortunately I could not find a character mapping table or anything listed under RFC 2045 Section
6.7. However I came across the website https://dencode.com/en/string/quoted-printable
which allows you to manually choose the encoding (it's an open source site, they have a GIT
repository for the morbidly curious).
As it turns out the start of the range is relative to the encoding. So Latin (ISO-8859-1) and
Russian (KOI8-R) will likely (not tested this) encode to different characters **relative to the
string encoding**.
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.156.130 (proxied: 193.27.12.44)
----
Manual Page -- http://php.net/manual/en/function.quoted-printable-decode.php
Edit -- https://master.php.net/note/edit/125548
Del: integrated -- https://master.php.net/note/delete/125548/integrated
Del: useless -- https://master.php.net/note/delete/125548/useless
Del: bad code -- https://master.php.net/note/delete/125548/bad+code
Del: spam -- https://master.php.net/note/delete/125548/spam
Del: non-english -- https://master.php.net/note/delete/125548/non-english
Del: in docs -- https://master.php.net/note/delete/125548/in+docs
Del: other reasons-- https://master.php.net/note/delete/125548
Reject -- https://master.php.net/note/reject/125548
Search -- https://master.php.net/manage/user-notes.php