[EventCalendar] ec3_get_events() not translating ampersands into
character entities
ejm
cq547 at torfree.net
Fri Oct 5 20:35:04 UTC 2007
Thank you for your replies, JD and A;
>> Should be:
>> $data['TITLE'] = 'Subject: '.htmlentities($entry->post_title, ENT_QUOTES);
Yes, you are absolutely right. I had realized my error after my first
email and tried to convey that in the note that is here:
http://penguin.firetree.net/pipermail/eventcalendar/2007-October/002502.html.
But I had not added the "ENT_QUOTES" - good idea.
>> Regarding your validation problem, you've got a long dash (em dash) in
>> your event in Vancouver. That's breaking the UTF-8 validation.
Aha!! Thank you! I thought that the validator would catch any of those
and tell me. (I only host this wordpress for someone else - I do not
make any of the entries. I check it on a fairly regular basis but do
not really have the time to chase after these 'made for print'
characters. I suppose if I get energetic, I might try to add a string
replace for em-dashes and en-dashes. Quite often for that particular
wordpress, things are being copied and pasted from pdf documents - ie:
documents that are designed for print. In the meantime, I have
replaced the offending character in the post title.)
This is the coding that I now have in eventcalendar3 >
template-functions.php
$data['TITLE'] =htmlentities($entry->post_title,ENT_QUOTES);
$data['LINK'] =get_permalink($entry->id);
$data['AUTHOR']=htmlentities($entry->author,ENT_QUOTES);
It's getting closer, but the page still does not validate. For some
reason, the semicolon is not being added to any of the character
entities. Here is just one of the error messages:
---------------------------------
Line 723, Column 197: reference not terminated by REFC delimiter.
[...]071101" title="Event: This month' s events: CRNC ACR
peace.ca and media
If you meant to include an entity that starts with "&", then you
should terminate it with ";". Another reason for this error message is
that you inadvertently created an entity by failing to escape an "&"
character just before this text.
------------------------------
-E
peacemakers.ca.etherwork.net/bulletins/
In an effort to keep spammers at bay, I would prefer that the
address of the peacemakers wordpress site NOT be made into a link for
these archives.
On Fri, 05 Oct 2007 18:41:18 +0100, Alex Tingle <alex at firetree.net>
wrote:
>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
More information about the EventCalendar
mailing list