[EventCalendar] ec3_get_events() not translating ampersands into character entities

Alex Tingle alex at firetree.net
Fri Oct 5 17:41:18 UTC 2007


JD Puglisi wrote:
> Should be:
> $data['TITLE'] = 'Subject: '.htmlentities($entry->post_title, ENT_QUOTES);

Aarrgh! Thank you.

Here's what I wrote in my code (rather than the nonsense I e-mailed here)...

       $data['TITLE'] =htmlentities($entry->post_title,ENT_QUOTES);
       $data['LINK']  =get_permalink($entry->id);
       $data['AUTHOR']=htmlentities($entry->author,ENT_QUOTES);

Elizabeth, Try that and see how you get on.


> Regarding your validation problem, you've got a long dash (em dash) in 
> your event in Vancouver. That's breaking the UTF-8 validation. Easy way 
> to check is to change the validation scheme to ISO-8859-1 and it will 
> present your errors. You'll have to retype the title in that event (or 
> change to the ISO-8859-1 charset).

Everything in WordPress is supposed to be in UTF-8.

Reading the docs (http://uk.php.net/manual/en/function.htmlentities.php) 
tells me that htmlentities() can be given a charset parameter. I haven't 
tried this, but here goes...

     $data['TITLE'] =htmlentities($entry->post_title,ENT_QUOTES,'UTF-8');
     $data['LINK']  =get_permalink($entry->id);
     $data['AUTHOR']=htmlentities($entry->author,ENT_QUOTES,'UTF-8');

Alternatively, you can leave your (hopefully UFT-8 encoded) titles 
alone, with this...

     $data['TITLE'] =htmlspecialchars($entry->post_title,ENT_QUOTES);
     $data['LINK']  =get_permalink($entry->id);
     $data['AUTHOR']=htmlspecialchars($entry->author,ENT_QUOTES);

Let me know if you get it working.

-Alex

-- 
:: Let me solve your problems: http://www.firetree.net/consulting/
:: alex.tingle AT firetree.net  +44-7901-552763



More information about the EventCalendar mailing list