How to use special characters in recipients name when using PHP’s mail function

mb_encode_mimeheader should do it, just as shown in the example: mb_internal_encoding(‘UTF-8’); $name=”山本”; $email=”[email protected]”; $addr = mb_encode_mimeheader($name, ‘UTF-8’, ‘Q’) . ” <$email>”; For better compatibility you should set the header Mime-Version: 1.0 so all mail clients understand you’re using MIME encoding. The final email headers should look like this: To: =?UTF-8?Q?=E5=B0=81=E3=83=90=E3=83=BC?= <[email protected]> Subject: =?UTF-8?Q?=E3=81=93=E3=82=93=E3=81=AB=E3=81=A1=E3=81=AF?= Mime-Version: 1.0 … Read more

Detect browser character support in javascript?

If you create two SPANs, one containing the character you want, and the other containing an unprintable character U+FFFD (�) is a good one, then you can test whether they have the same width. <div style=”visibility:hidden”> <span id=”char-to-check”>&#9839;</span> <span id=”not-renderable”>&#xfffd;</span> </div> <script> alert(document.getElementById(‘char-to-check’).offsetWidth === document.getElementById(‘not-renderable’).offsetWidth ? ‘not supported’ : ‘supported’); </script> You should make sure … Read more

MySQL diacritic insensitive search (spanish accents)

Character sets & collations, not my favorites, but they DO work: mysql> SET NAMES latin1; mysql> SELECT ‘lápiz’ LIKE ‘lapiz’; +———————–+ | ‘lápiz’ LIKE ‘lapiz’ | +———————–+ | 0 | +———————–+ 1 row in set (0.01 sec) mysql> SET NAMES utf8; mysql> SELECT ‘lápiz’ LIKE ‘lapiz’; +———————–+ | ‘lápiz’ LIKE ‘lapiz’ | +———————–+ | 1 … Read more

PHP + SQL Server – How to set charset for connection?

Client charset is necessary but not sufficient: ini_set(‘mssql.charset’, ‘UTF-8′); I searched for two days how to insert UTF-8 data (from web forms) into MSSQL 2008 through PHP. I read everywhere that you can’t, you need to convert to UCS2 first (like cypher’s solution recommends). On Windows SQLSRV said to be a good solution, which I … Read more