Search This Blog

Monday, June 29, 2009

I need to vent

Grr, f***, sh**, a** f***! I am setting up one of my PHP CMS's and was having trouble with non-ASCII characters. After pulling my hair out and endless googling I found the problem, htmlentities(). It turns out that htmlentities() is set to ISO-8859-1 by default and needs a specific parameter to be UTF-8.

I found this:

/**
 * Encodes HTML safely for UTF-8. Use instead of htmlentities.
 *
 * @param string $var
 * @return string
 */
function html_encode($var)
{
 return htmlentities($var, ENT_QUOTES, 'UTF-8') ;
}

Here:
http://developer.loftdigital.com/blog/php-utf-8-cheatsheet

1 comment:

Unknown said...

Best No Deposit Bonus Codes in India - Herzamanindir.com
5 steps1.Visit the 바카라 official website of No Deposit India.
Benefits of using a no deposit bonus.
Benefits of using a no deposit bonus.
Benefits of using aprcasino a no jancasino deposit bonus.
Online goyangfc.com Sincere Accessory domain www.online-bookmakers.info