Jump to content

[SOLVED] Character set encoding / smart quotes problem


grejon04

Recommended Posts

 

Ah, i see what's going on here. I bet I could incorporate the iconv function in there too. That way, I could define the function from one of my include files, and just call it whenever I needed it (which is a lot).

 

function htmlentities_iso88592($string='') {
    $pl_iso = array('ê', 'ó', '±', '¶', '³', '¿', 
'¼', 'æ', 'ñ', 'Ê', 'Ó', '¡', '¦',
'£', '¬', '¯', 'Æ', 'Ñ');    
    $entitles = get_html_translation_table(HTML_ENTITIES);
    $entitles = array_diff($entitles, $pl_iso);
    $string = strtr($string, $entitles);
    $string = iconv("ISO-8859-1", "UTF-8", $string)
    return $string;

 

What do you think?

 

I did a lot of work on this, and found that the problem was that sometimes the initial conversions either didn't work, or converted to an html char (like 'â', for example), and when it would seem like the functions weren't converting, they actually were working - it's just that the html entities had been made into plaintext and it didn't see them or something...

 

I ended up declaring a function in one of my include files, and just calling it whenever conversions were needed. The iconv("ISO-8859-1", "UTF-8", $string) function does the majority of the work.

 

Also, for anyone who didn't know as I didn't, changing the meta tag in the HTML like this

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

dictates the output character set.

 

Thanks for your help, effigy, darkfreaks...

 

j

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.