alin19 Posted April 8, 2010 Share Posted April 8, 2010 i get this text from an email: "STARTSMS ££££ ENDSMS" and the write it into a file, but i get: "STARTSMS =A3=A3=A3=A3 ENDSMS" this is actually a larger part of the email that i get from the server: Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable STARTSMS =A3=A3=A3=A3 ENDSMS =0A=0A=0A --0-1766339983-1270731703=:14998 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable i tryed like this: $input = file_get_contents("php://stdin"); mb_convert_encoding($input, "UTF-8", "ASCII"); $fp=fopen("test.txt","w"); fwrite($fp,mb_detect_encoding($input)); fwrite($fp,"\n\n".$input); fclose($fp); but in the file i still file ASCII and the wrong text. Need some help Thanks Link to comment https://forums.phpfreaks.com/topic/198018-ascii-to-utf-8/ Share on other sites More sharing options...
alin19 Posted April 8, 2010 Author Share Posted April 8, 2010 i have made some progress : $input=utf8_decode(quoted_printable_decode (file_get_contents("php://stdin"))); will get me the string into: ISO-8859-1 (this is the format that i need); but still there is a problem : "€" is shown as "?" any ideea? Later edit: $input=utf8_decode ("€"); $input=quoted_printable_encode($input); echo bin2hex(utf8_decode(quoted_printable_decode($input))); this script outputs 3F that is the hex for "?"; for € should be "80" any idea ? Link to comment https://forums.phpfreaks.com/topic/198018-ascii-to-utf-8/#findComment-1039088 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.