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?

Link to comment
Share on other sites

 

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.