imap_utf8 not always converting utf-8 text

9 hours ago 2
ARTICLE AD BOX

I have the following simple script, running under PHP 8.3.6

<?php $original = '"=?utf-8?Q?part1=40part2.com?=" <[email protected]>' ; $converted = imap_utf8($original) ; printf("Original: %s\nConverted: %s\n", $original, $converted) ;

When this is executed, the result is that the $converted text is exactly equal to the original text.

I get values like this (especially in the TO field) when using IMAP_SEARCH and other functions that return headers. I am sure this will be widespread, I just just getting into initial testing with PHP IMAP. Note in particular the embedded double-quotes, which may be (a part of) the problem.

What is the appropriate way to decode a value like the above?

Read Entire Article