I’m developing a program which uses PHPMailer. I want to change “Content-transfer-encoding” in header of email. Here is my eml format email header sample. BUT I want to change “quoted-printable” to “base64” Is there any solution change encoding?? Answer You could try reading the documentation, or looking at the source code. In short, do this: But I wouldn’t advise doing
Tag: encoding
PHP7.1 mcrypt alternative
Mcrypt function has been deprecated as of PHP 7.1.0. My deprecated string encode / decode functions: $key: secret key $str: string $encoded = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($…
preg_match accented characters
I have an issue using preg_match with php. I want my users to fill the Name field with only valid characters. Ex: no numbers or special chars. My site will eventually be bilingual but most of my visitors are french Canadians I prefer utf-8 for my encoding. So at the top of my document i have this tag : I
Encoding for SMS messages
I’m currently building an application which uses Nexmo to send SMS messages to users. But I’m experiencing some problems with the encoding of messages. Probably worth metioning; I’m using the prawnsalad/Nexmo-PHP-lib library to connect with their API. A simple text messages of 160 characters is divided into 3 separate messages. According to the Nexmo support, this is caused by the
PHP, convert UTF-8 to ASCII 8-bit
I’m trying to convert a string from UTF-8 to ASCII 8-bit by using the iconv function. The string is meant to be imported into an accounting software (some basic instructions parsed accordingly to SIE standards). What I’m running now: This works for accounting software #1, but software #2 complains about the encoding. Specified encoding by the standard is: IBM PC
Encoding SQL_Latin1_General_CP1_CI_AS into UTF-8
I’m generating a XML file with PHP using DomDocument and I need to handle asian characters. I’m pulling data from the MSSQL2008 server using the pdo_mssql driver and I apply utf8_encode() on the XML …
How can I detect a malformed UTF-8 string in PHP?
The iconv function sometimes gives me an error: Is there a way to detect that there are illegal characters in a UTF-8 string before sending data to inconv()? Answer First, note that it is not possible to detect whether text belongs to a specific undesired encoding. You can only check whether a string is valid in a given encoding. You
Email from PHP has broken Subject header encoding
My PHP script sends email to users and when the email arrives to their mailboxes, the subject line ($subject) has characters like a^£ added to the end of my subject text. This is obviously and …
How to handle user input of invalid UTF-8 characters
I’m looking for a general strategy/advice on how to handle invalid UTF-8 input from users. Even though my web application uses UTF-8, somehow some users enter invalid characters. This causes errors in PHP’s json_encode() and overall seems like a bad idea to have around. W3C I18N FAQ: Multilingual Forms says “If non-UTF-8 data is received, an error message should be