Steps to reproduce:

  1. Create a CCK field with a label that contains an apostrophe, like "President's Name"
  2. Then, in a view, click the "+" image button next to "Fields"
  3. Find the "President's name" field, click the checkbox, and then click the "Update" button
  4. The Ajax replacement will now display a heading that says, "Configure field Content: President's Name (field_president_name)"

I'm not sure where this happens, whether in Views or CCK, but it appears that the apostrophe is getting escaped twice.

Comments

garryh’s picture

This issue seems to depend on the style of the view display. The link below came out of a table style view. Look at the mess in the alt and title tags.

<a href="/node/89" title="Monday&amp;amp;#039;s lineup" alt="Monday&amp;amp;#039;s lineup">Monday&#039;s lineup</a>

Unencoded ampersands in taxonomy term names wreak havoc too.

joecanti’s picture

I get this same problem when adding descriptions to images uploaded via the CCK imagefield, so I guess this might be the cause. For now I'm using the accent instead of the apostrophe eg `instead of ' - Did you get anywhere in solving this problem?

thanks joe

alex72rm’s picture

Version: 6.x-2.6 » 6.x-2.8
Component: User interface » exposed filters

subscribe

ethnovode’s picture

Subscribe

epersonae2’s picture

I'm having this issue with a taxonomy item with an apostrophe - "President's Club" - which is used as an argument in a link.

<a href="/?q=awardslist/President%26#039;s Club">President's Club</a>

I'm going to either try joeclanti's cludge (`) or see if I can make the argument work with the taxonomy ID instead.

epersonae2’s picture

Title: CCK Fields with apostrophes not displaying correctly » Fields with apostrophes not displaying correctly

changing title - removing "CCK", since it looks like it's any field with an apostrophe.

eiland’s picture

Priority: Normal » Minor

This one is prettier to use as replacement:

cmav77’s picture

While this doesn't attack the problem at the root, I've found this is a good interim solution if you're printing your own tags. Use the htmlspecialchars_decode function to convert the html entities to their characters.

htmlspecialchars_decode($term, ENT_QUOTES)

(the html_entity_decode function might come in handy as well)

Note that the ENT_QUOTES flag makes the function process single quotes (apostrophes).

For example, I've done this to print out my tags for a given node:

   $html = '';
   foreach($tags as $r){

	//Get the term name.  Retrieve it from the DB if not already present
	$term = isset($r['view']) ? $r['view'] : taxonomy_get_term($r['value'])->name; 

	//Print the term as a link
	$html.= l(htmlspecialchars_decode($term, ENT_QUOTES),'taxonomy/term/'.$r['value']) .', ';
   }
   echo trim($html, ', ');

Hope that helps!

beckyjohnson’s picture

cmav77, how would you re-write this to deal with apostrophes and the description field that attaches to images?

I assume I have to replace this code with my own, pertaining to the description field:

$term = isset($r['view']) ? $r['view'] : taxonomy_get_term($r['value'])->name;

But, how do I know what variable to use instead of $term?

locomo’s picture

subscribe

pomliane’s picture

Version: 6.x-2.8 » 6.x-2.9
PMatwyuk’s picture

subscribing

kla2t’s picture

subscribing

kla2t’s picture

@cmav77: Your contribution was very helpful to me. I ran into the apostrophe problem with a custom link, too, and I solved it for the time being with a hack of views_handler_field.inc.
In line 566 (v 1.33.2.13) I added the ENT_QUOTES flag:

-      $path = strip_tags(html_entity_decode(strtr($path, $tokens))); 
+      $path = strip_tags(html_entity_decode(strtr($path, $tokens), ENT_QUOTES)); 

- and now the single quote gets processed.
Actually, I cannot tell if the ENT_QUOTES solution will cause new issues (e.g. in combination with Pathauto), but I think it might be worth proposing it as a patch.

esmerel’s picture

Issue tags: +special characters

adding tag

kla2t’s picture

Status: Active » Needs review
StatusFileSize
new751 bytes

#14 as a patch for views/handlers/views_handler_field.inc:

pomliane’s picture

No "official answer" on this issue (and its child issues as in #2)?

Considering almost everybody uses Views and the characters concerned are common in different languages shouldn't there be a lot more susbcribers to this issue? Or, in other words — and really sorry to ask this... — aren't we missing something?

On the other hand if this really is an issue and it affects as many facets of Views, shouldn't its priority be set to "major"?

dawehner’s picture

There are so many issues in the issue queue, i doubt that using another priority really helps.

The patch looks fine but it would be cool if some users could test the patch.

pomliane’s picture

Version: 6.x-2.9 » 6.x-2.11

Patch at #16 tested on one installation and, unfortunately, no effect with Views 6.x-2.11 — or even Views 6.x-2.9 here...

ethnovode’s picture

Same here, no effect with views 2.11.

dawehner’s picture

Status: Needs review » Needs work

So

Jessica A’s picture

Priority: Minor » Major
dawehner’s picture

Priority: Major » Minor

Moving back to the old status. You should at least give a reason.

I reallity this doesn't matter because i guess not many people in contrib will look at them.

Jessica A’s picture

I had this issue and was going to post as major but now I've solved the problem on my end.

Not sure if this is the same for others, but it was just an end user error on my part. Had the cck field configured to plain text instead of filtered.

clashar’s picture

subscribe

I have CCK with Content Taxonomy, so I think I can't choose any plain or HTML format.

j0nathan’s picture

Not sure if this is related, but I'm coming from #542974: Cleaning FileField Path and Filename: single quotes are replaced by 039
Subscribing.

geerlingguy’s picture

Version: 6.x-2.11 » 6.x-2.12

Coming from #613324: Apostrophe in term name causes argument title to display html character code - the RSS feed title is borked on my site, when I use a taxonomy term as an argument. Here's the <link> markup that views outputs:

<link rel="alternate" type="application/rss+xml" title="Archbishop&amp;#039;s column" href="/taxonomy/term/31/all/feed" />

Additionally, the feed itself (http://stlouisreview.com/taxonomy/term/31/all/feed) shows:

<title>Archbishop&amp;#039;s column</title>

The title should be "Archbishop's column"

(page with example: http://stlouisreview.com/category/section/archbishops-column)

loicgao’s picture

Subscribe

jlord87’s picture

sorry for my noobness but may this problem be related to this issue?

http://www.fuyu.it/immagini/coloured/hansel-e-gretel

(look at the image description -> "L& #039; effetto" instead of "L'effetto;")

I've used the field description of the images in cck.

Content Construction Kit (CCK) 6.x-2.9
Views 6.x-2.x-dev (2011-Gen-05)

thanks

BlueBlossom’s picture

Has anyone come up with a solution for this?

I am having the problem in my exposed filters - everywhere else it is fine. I tried BEF with the same results. I cam using CCK with Content Taxonomy.

I have tried every patch I could find without any luck.

feuillet’s picture

I am having the problem in my exposed filters - everywhere else it is fine. I tried BEF with the same results. I cam using CCK with Content Taxonomy.

Exactly the same Problem here

+subscribe

aaronelborg’s picture

subscribing. same problem. node title in a view with style of 'RSS Feed - Fields'

shaneonabike’s picture

shaneonabike’s picture

Actually what's interesting is if you use Taxonomy as a filter itself this isn't a problem, but if you use Content: Fieldname (Content Taxonomy Fields) it is encoded?

davidneedham’s picture

This also happens for node titles in my view. The proposed fix in #14 and the patch in #16 don't work for me.

davidneedham’s picture

Priority: Minor » Normal

This is hardly a 'minor' issue.

mennonot’s picture

Status: Needs work » Active

+1 I'm having this problem when using views to display the Description field for images uploaded via the CCK imagefield. I am not using exposed filters at all.

I tried this patch from Merlionofchaos for a similar issue and it did not work

Modules
Views 6.x-2.12
Content 6.x-2.9
FileField 6.x-3.9
ImageField 6.x-3.9

carsonw’s picture

+1

Crom’s picture

Same problem as #27 - subscribing

effulgentsia’s picture

Cross-linking #1373584: Apostrophes (single quotes) in token values used for link path in "Output this field as a link" are double-escaped and #1373588: Use decode_entities() instead of html_entity_decode(). If the latter is committed and backported to 6.x, that should fix this issue, but not marking this a duplicate yet in case that patch doesn't fly.

dawehner’s picture

Status: Active » Closed (duplicate)