Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-10-13 18:35:14

Malial
New Member
Registered: 2005-04-15
Posts: 4
Website

Custom Fields do not encode ampersands

I’ve seen this mentioned in the forums, but my search did not find it as a bug report here.

When using custom fields for URLs, the ampersand is not encoded correctly. Even if you hard code the ampersand, it does not seem to stay. Seems that this should work correctly.

I have a couple custom fields setup to handle a “link blog” section, and any URL that contains an ampersand fails validation.

I think I can setup up the section using the excerpt with Textile turned off to hold the link text so it encodes correclty, but this seems clumsy compared to my original setup.

Any chance getting this added to the list if not already on there?

Thanks.

Offline

#2 2005-10-13 22:57:43

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Custom Fields do not encode ampersands

I don’t think encoding the data that’s stored in the fields is the right thing to do, because not all custom field data will be intended for display in the same manner.

It wouldn’t be too hard to encode on the output side though, via an attribute to the custom_field tag. <txp:custom_field name="foo" encode="html" /> or something like that.

Can anyone else suggest other uses for custom fields that might require different kinds of encoding?


Alex

Offline

#3 2005-10-14 00:48:49

Malial
New Member
Registered: 2005-04-15
Posts: 4
Website

Re: Custom Fields do not encode ampersands

That sounds like the perfect solution. That way you have the option at your disposal depending on the need of the field.

Offline

#4 2005-10-14 12:01:29

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: Custom Fields do not encode ampersands

I didn’t thought of it first, but yes. Some data may be non-xml here, for example a filepath or a filename. An xml encoding output would be nice, but I can’t see other needed encoding type (except raw , aka no format).

Offline

#5 2006-02-19 08:04:29

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,163
Website GitHub Mastodon Twitter

Re: Custom Fields do not encode ampersands

I don’t know if this will help. Just brain storming
A custom field might be used as a
meta description,
url holder on a per article basis,
keywords/menu (plugins),
title,
sub title
image holder


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#6 2006-07-04 15:42:12

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Custom Fields do not encode ampersands

This was added in r1255.

What would the xml encoding be, Jeremie?

Offline

Board footer

Powered by FluxBB