Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2016-09-28 17:08:45

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

entities in caption

In the latest 4.6 release html entities are replaced with their glyphs upon save. ie č is replaced with a Č. I remember we had a similar problem with the custom fields a few years back. I am also not certain if this bug was there on the previous release.

> Edit: Found the previous bug here

Edited to correct my self that it is not the entities but the numeric character references which are replaced.

Last edited by colak (2016-09-29 05:27:50)


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

Offline

#2 2016-09-29 08:11:36

etc
Developer
Registered: 2010-11-11
Posts: 5,187
Website GitHub

Re: entities in caption

Hi Yiannis,

I can fix it (and we should fix it, actually), but then people that used, say, non-breaking spaces in captions will get the literal  . Do we care? On the other hand, these   are currently converted into simple spaces on the second image save anyway…

Offline

#3 2016-09-29 08:26:55

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

Re: entities in caption

etc wrote #301812:

Hi Yiannis,

I can fix it (and we should fix it, actually), but then people that used, say, non-breaking spaces in captions will get the literal  . Do we care? On the other hand, these   are currently converted into simple spaces on the second image save anyway…

Would this also happen with the ampersands? ie would & be converted into & in the back end and by extension to the front end which would result in non valid html?


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

Offline

#4 2016-09-29 08:42:57

etc
Developer
Registered: 2010-11-11
Posts: 5,187
Website GitHub

Re: entities in caption

Currently & is converted into &, yes. With the fix I propose it would stay as is.

Offline

#5 2016-09-29 08:51:05

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

Re: entities in caption

etc wrote #301814:

Currently & is converted into &, yes. With the fix I propose it would stay as is.

So as to clear things up:) The html encodings will remain visible in the back end but they will appear properly in the front end. The   being an exception. Right?


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 2016-09-29 09:04:38

etc
Developer
Registered: 2010-11-11
Posts: 5,187
Website GitHub

Re: entities in caption

No :-) They will all appear the same on front and back ends. Unless we patch <txp:image_info type="caption" /> too. But then you won’t be able to display a literal &nbsp; in captions. Weird!

Offline

#7 2016-09-29 11:03:44

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

Re: entities in caption

etc wrote #301816:

… Unless we patch <txp:image_info type="caption" /> too.

Then this is what should be patched then:) The whole issue I raised was to achieve html validity.


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

Offline

#8 2016-09-29 12:59:20

etc
Developer
Registered: 2010-11-11
Posts: 5,187
Website GitHub

Re: entities in caption

So, after some tests:

  • Image caption and file description transform (after few saves) &amp; into &, both public and admin side;
  • Article/link descriptions preserve &amp;, both sides;

Needed behavior: keep &amp; in admin-side textareas, but output it as & public side?

Offline

#9 2016-09-29 13:14:39

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,188
Website

Re: entities in caption

If the page uses UTF-8 there is rarely, if ever, a need to use entities in the source code. And you should never use anything then UTF-8 else nowadays. > and < are probably the two exceptions, & could be considered an edge case.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#10 2016-09-29 14:11:13

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

Re: entities in caption

phiw13 wrote #301829:

If the page uses UTF-8 there is rarely, if ever, a need to use entities in the source code. And you should never use anything then UTF-8 else nowadays. > and < are probably the two exceptions, & could be considered an edge case.

I use utf-8 but I had to use entities to validate this page which is generated purely from the images interface. Check the publication on the top where you have &, ä, č, Ç, and ğ. The strange thing is that on first save (using entities) all validates ok but on returning to an image, to edit it again, the validation goes out of the window unless I re-write all the entities again.


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 2016-09-29 21:38:29

etc
Developer
Registered: 2010-11-11
Posts: 5,187
Website GitHub

Re: entities in caption

colak wrote #301835:

The strange thing is that on first save (using entities) all validates ok but on returning to an image, to edit it again, the validation goes out of the window unless I re-write all the entities again.

This should be fixed in 4.6.1, but now to output &#269; as č public side, you’ll need to call <txp:image_info type="caption" escape="" /> (note escape="" attribute).

Offline

#12 2016-09-30 06:03:17

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

Re: entities in caption

Hi Oleg, I have the escape attribute already

<figcaption class="grid_17 prefix_1">
<txp:image_info type="caption" escape="" />
</figcaption>

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

Offline

Board footer

Powered by FluxBB