Closed (duplicate)
Project:
Entity reference
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
7 Jul 2012 at 16:49 UTC
Updated:
8 Oct 2019 at 12:44 UTC
Jump to comment: Most recent
The entity reference dropdown isn't showing special characters in title properly. I tried both Simple and Views selection modes.
Ex.
A node titled "Test's 1" displays as "Test's 1"
Comments
Comment #1
zdean commentedI'm also seeing this. The title "Test's" shows as "Test&039;s"
Comment #2
Graham Brand commentedThis was giving me an issue when using an entity reference field in a contextual filter on a view. Entities where the Title contains an apostrophe are not being selected by a contextual filter on Title, which I suppose is comparing the actual Titles of the content type (without HTML entity versions of the apostrophe) with the Titles held by the entity reference field (which have the HTML entity versions of the apostrophe).
I got round this by passing the Nid as an argument and using that instead, but I could see this being a problem where someone really did need to filter on the Title.
Comment #3
bunthorne commentedI'm having the same problem where my ampersands in title fields are displaying as their HTML entity (
&) in the select lists. It looks like this issue was addressed separately in the References module at http://drupal.org/node/1391814, although I don't know if it's the same problem and/or solution.Comment #4
maxplus commentedHi,
I'm having the same problem with the & symbol in a node title and using a select list.
Does anybody have a solution or a temporary workaround for this?
I don't know exactly how this is solved for the References module in the latest dev.
Comment #5
kunago commentedI have dirty-fixed this issue since I have also been experiencing '&' issue and to be honest, I simply don't like to see this in the options list.
I have discovered the function "filter_xss_admin" in "entityreference_plugin_style.inc" is to blame. Unless someone reviews the necessity of converting each entity to the code there might only be dirty fixes.
Comment #6
damien tournoud commentedSee #1665818: Ampersands and other characters are not displayed correctly in <select> widgets
Comment #7
SharonD214@aol.com commentedHow did you fix this? I've got an apostrophe that should in my entity list as
'that I would like to get rid of.Thanks
Sharon
Comment #8
SharonD214@aol.com commentedComment #9
Guido Forks commentedI added this bit of Javascript into page.tpl.php which I found on another thread (I've changed it include encoded apostrophes):
Original code by this chap here: https://www.drupal.org/node/1665818#comment-8507309
Phil
Comment #10
SharonD214@aol.com commentedPhil - Thanks this works great!
Sharon
Comment #11
philyPatch on comment #32 at https://www.drupal.org/node/1665818#comment-7069158 works for me with Drupal 7.36 and Entity Reference 7.x-1.1
Comment #12
weri commentedComment #13
weri commentedIt's related to this core bug.
Comment #14
dipali.dhole commented#9 works fine for me. +1
Comment #15
caldenjacobs commentedI'm running latest 7.50.x core and still experiencing this issue, so it's not fixed by #12 or #13, unless I'm missing something.
#11 works for me manually applied against the latest dev release.
Comment #16
virajrajankar commentedComment #17
virajrajankar commentedYou can use this function drupal_html_to_text($string, $allowed_tags = NULL) to remove special character from any string.
You will get the output of
You Know You’to"You Know You’".You need to write hook_node_presave in your custom module to use "drupal_html_to_text()".
Example Code :
Create custom module and put below code.
Comment #18
rooby commentedThere is no patch to review.
Comment #19
rooby commentedClosing as duplicate of #2400689: Special characters in node titles are not rendered correctly
Comment #20
rooby commentedComment #21
NumanAslam commentedUse htmlspecialchars_decode() function
Comment #22
silentbob commentedMaybe this helps someone somehow. Its a different context but i had also an issue with special characters using the t() function.
If the node title is like this: Hello here comes my special character '
The ' would be rendered as #039;
Changing the placeholder variable prefix from @ to ! solved my issue. As it outputs the title as it is, without any restriction.