Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-12-19 03:35:16

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

page_title escaping character entities

I entered this:

<txp:page_title separator=" &183; " />

And I get this:

My Site &amp;#183; Section

I checked the Textbook, which includes this example:

<title><txp:page_title separator=" &raquo; " /></title>

But if I use &raquo; I get &amp;raquo;.

Is there a way to use properly formatted entities as a separator, without turning the & into &amp;?

Offline

#2 2008-12-19 08:40:23

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: page_title escaping character entities

See ruud’s solution in a similar thread


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2008-12-19 16:19:05

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: page_title escaping character entities

Thanks. I tried that with &183; (AKA &middot;), which is Shift-Alt-9 on my Mac keyboard: ·

Textpattern didn’t escape it all— the middot appears in the source code exactly as entered in the tag.

And— it successfully validated as XHTML 1.0 Strict. I thought special characters had to be converted into &entities; in order to validate. What’s the truth?

Offline

#4 2008-12-19 16:25:29

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

Re: page_title escaping character entities

johnstephens wrote:

And— it successfully validated as XHTML 1.0 Strict. I thought special characters had to be converted into &entities; in order to validate. What’s the truth?

Special characters should be converted into their entities but not because of validation but rather for cross-platform/browser/system uniformity.

I found that the W3 validator only throws errors with the unescaped ampersands & but copy paste characters shuch as bull emdash etc are not recognised as being problematic.

This, in my view, is a bug with the validator.


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

Offline

#5 2008-12-19 17:27:17

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: page_title escaping character entities

Thank you, Yiannis.

So, if I want to use this character I shouldn’t use the <txp:page_title /> tag?

Offline

#6 2008-12-20 07:05:20

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: page_title escaping character entities

In TXP tag attribute values you should not use HTML entities. TXP tags should escape attribute values if needed automatically. In older TXP versions there were a few cases where escaping wasn’t done correctly.

Outside TXP, in the normal HTML code, when using UTF8, the only characters that need escaping are " & > <, because those characters have special meaning in (X)HTML. Using entities for other characters (like &middot;) is needed only when using a character set that doesn’t support that character, so I think the W3 validator behaviour is correct.

Offline

#7 2008-12-20 18:44:50

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: page_title escaping character entities

Thank you, Ruud, for clarifying that. Is there a good reference somewhere showing what characters are included in utf-8?

Offline

#8 2008-12-20 18:56:49

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

Re: page_title escaping character entities

johnstephens wrote:

Thank you, Ruud, for clarifying that. Is there a good reference somewhere showing what characters are included in utf-8?

Here it is.

Last edited by colak (2008-12-20 18:58:38)


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

Offline

#9 2008-12-20 19:09:08

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: page_title escaping character entities

johnstephens wrote:

Thank you, Ruud, for clarifying that. Is there a good reference somewhere showing what characters are included in utf-8?

Any character in the Unicode standard. Says something? ;) That list of colaks is r-e-a-l-l-y long.

Last edited by Gocom (2008-12-20 19:10:47)

Offline

#10 2008-12-20 19:09:21

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

Re: page_title escaping character entities

And here’s a list apart article on the subject.

Last edited by colak (2008-12-20 19:10:51)


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

Offline

#11 2008-12-20 19:14:43

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: page_title escaping character entities

As far as I know, all characters are included in utf8.

Offline

#12 2008-12-20 19:18:39

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,821
Website GitHub

Re: page_title escaping character entities

Even Klingon (sort of)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB