Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I have a problem when I use this character in a taxonomy term : '
This character, when I put the taxonomy term token in the node title is translated by '
For example, the taxonomy term L'auberge
is translated by L'auberge
in my node title.
I don't have problem with others stpecial characters, and I test all available token (formated, raw...).
Can you help me ?
Comments
Comment #1
vstmusic CreditAttribution: vstmusic commentedPlease, no idea ?
Comment #2
fagoFor me both characters look equal?
Comment #3
Witch CreditAttribution: Witch commentedI have problems mit the "&" chars in taxonomy terms + autonodetitle. It will display a ""&"
Can you look into it?
Comment #4
apadernoI guess the OP meant the character is replaced by an HTML entity. As he wrote the code without escaping the HTML entity, it was shown from the input format as normal character.
Isn't this caused by the tokens that are passed to
check_plain()
?Comment #5
Witch CreditAttribution: Witch commentedOh sorry, "&" appears as
&
How can i check this, kiam?
Comment #6
fagoAs noted in the description text, you should use raw tokens. If the token is raw, the characters are displayed correctly (= check_plained() once).
Comment #8
Nchase CreditAttribution: Nchase commentedreopening it.
What if there are no -raw values available, like for example tokens coming from locations? Is this tean a token issue or a locations issue?
Comment #9
apadernoIt is an issue of the module that provide the extra tokens without to provide a raw version.
Comment #10
johnvI have the same problem as #3, with a simple PlainText field in Drupal 7. Only "&" and "'" give a problem, all other accents like "ø" are fine. Since it concerns a core field type, should I request a raw-token over there?
Comment #11
johnvwrong version.
Comment #12
johnvFor future reference, I have solved it like this:
My field 'field_name' = 'foo&bar'.
Using token [node:field-name], the result is 'foo&bar'. (a straight text field does not have alternative tokens.)
The correct value appears when setting
- 'Evaluate PHP in pattern.' = Yes
- 'Pattern for the title' =
return $node->field_name[$node->language][0]['value'];
Comment #13
Yuri CreditAttribution: Yuri commented#12 not working for me. The
'
and&
still show as'
and&
.I'm using a clean install of Drupal 7.8
Can anyone verify this? Thanks
By the way, 'raw' tokens don't exist any more in the latest Token module for Drupal 7, so that's not a solution.
Hope this issue gets resolved soon, makes this module useless for me.
Comment #14
andrew@oscailte.org CreditAttribution: andrew@oscailte.org commentedDrupal 7.8
Automatic Nodetitles 7.x-1.0
Token 7.x-1.0-beta6
I was having this same problem on a plain textfield value with names like
O'Brien
They were auto-titling as
O'Brien
I tried #12 and it worked for me.
Comment #15
GaëlG#12 is not so good. For reference fields for instance, it needs a lot of PHP code to check for array index existence, to load referenced node to get title,... As there is no raw tokens in D7, it makes tokens unusable for non-english languages, which makes the module pretty useless for people with no PHP skills. I don't really know if this is fixable, and if it should be fixed in Token or in this module, but I reopen this to get at least an answer.
Comment #16
tusharbodke CreditAttribution: tusharbodke commentedHi All,
Need help. Where and how to implement the solution provide at #12?
OR some alternative for references module
Thanks in advanced for your help.
Comment #17
ZeiP CreditAttribution: ZeiP commentedI got this ”fixed” by using the callback functionality of token_replace() to clean the entities, as suggested on token_replace() API entry (”For example, a module using tokens in a text-only email might provide a callback to strip HTML entities from token values before they are inserted into the final text.”). Patch attached, hope it works for others too.
Comment #18
Ivanhoe123 CreditAttribution: Ivanhoe123 commented#12 worked for me with apostrophes and ampersand characters
Thanks!
Comment #19
blattmann CreditAttribution: blattmann commentedThe patch in #18 does not seem to work for ampersands or apostrophes for me.
Comment #20
cangeceiro CreditAttribution: cangeceiro commentedthe patch in #17 didnt work for me, here is a revision of that patch that did resolve the issue for me
Comment #21
jenlamptonThis patch works great for me, re-roll only removes whitespace errors.
My use case was this:
1) I had some taxonomy terms with apostrophes and ampersands in them.
2) I had set up a content type that used the taxonomy term name in the node title.
Before the patch, the ampersands and apostrophes were converted to HTML entities when creating node titles.
Now, after this patch, the node titles are plain text, as expected.
Thanks @cangeceiro and @ZeiP
Comment #22
jenlamptonOh, I also think this was a bug in the original design.
Comment #23
bisonbleu CreditAttribution: bisonbleu commentedPatch in #21 works for me.
I had problem applying it. The second part (hunk) of the patch kept failing. I removed it and was able to apply patch (hunk #1). I then manually applied the second part of the patch (one line). Node title was showing a
'
. After applying patch, it is now replaced by a proper apostrophe. Thanks!Comment #24
Andrew_Mallis CreditAttribution: Andrew_Mallis commentedPatch did not work for me. It suddenly throws the following error (which populates the title field):
( ! ) Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/ttm/sites/all/modules/contrib/auto_nodetitle/auto_nodetitle.module(221) : eval()'d code on line 3Call Stack#TimeMemoryFunctionLocation10.0001732496{main}( )../index.php:02
It might be my code. I'm staring at it, but am getting googly eyes at this point:
Comment #25
sjohnson CreditAttribution: sjohnson commentedjenlampton — your patch worked for me; thank you!
Comment #26
cafuego CreditAttribution: cafuego commentedThe patch in #21 resolves the problem, but the file paths in the patch are relative to a Drupal root and not the module dir. Attached patch fixes the file paths only so I'm flipping it to RTBC.
Comment #27
cafuego CreditAttribution: cafuego commentedArgh, bump status.
Comment #28
venutip CreditAttribution: venutip commentedJust for good measure: I ran the patch in #26 against 7.x-1.0 (not the dev version) and can confirm that it solved the apostrophe problem.
Comment #29
vinmassaro CreditAttribution: vinmassaro commentedThe patch in #26 failed when applying to 7.x-1.x HEAD. I've rerolled it and given ZeiP attribution since he was the first one to post the original patch. I'll leave it at RTBC since it's just a reroll, and it applies cleanly now to 7.x-1.x:
Comment #30
fterrier CreditAttribution: fterrier commentedPatch in #29 worked for me.
Comment #31
mlncn CreditAttribution: mlncn commentedThe seven month bump. This patch works great to prevent quotation marks in a text field from being double-escaped and printed as HTML entities in the title. In production for us, adapted slightly for the latest stable release, 7.x-1.0. Can we get it committed?
Comment #32
mvcworked for me as well. i remember having to apply a similar patch in D6 for this module, too :/
Comment #33
stephesk8s CreditAttribution: stephesk8s commentedPatch #29 worked for me. Thank you.
Comment #34
botrisConfirming that patch #29
Comment #35
berliner CreditAttribution: berliner commentedConfirming that patch in #29 fixes the problem.
Can we expect to have this in the stable release anytime soon? This issue is pretty old and RTBC since 2 years now.
Comment #36
berliner CreditAttribution: berliner commentedAnyone looking for a patch that applies to 1.0-stable see attached.
Comment #37
esteinborn CreditAttribution: esteinborn commentedConfirming Patch #29 works to remedy the problem.
Comment #38
Tess Bakkerhtml_entities_decode() in the patch is not UTF-8 proof. It should use decode_entities().
Comment #39
cafuego CreditAttribution: cafuego as a volunteer commentedUpdated patch, now using Drupals
decode_entities()
which wraps an UTF8 safehtml_entity_decode()
call.Comment #40
SpadXIII CreditAttribution: SpadXIII at ezCompany commentedPatch looks alright, but I'd rather see the token module fully respect the sanitize-flag.
For field-values, the sanitize-flag is completely ignored. :(
Comment #41
Tess BakkerComment #42
achapPatch at #39 worked for me for stable 7.x-1.0 version. Probably goes without saying but you need to re-save any content with mangled htmlentities for the changes to take effect.
Comment #43
micahw156+1 for patch at #39.
It exactly matches the patch I've been running in production for over three years with the exception of using decode_entities(), which is a logical improvement.
Comment #44
Utkarsh_Mishra CreditAttribution: Utkarsh_Mishra at OpenSense Labs for DrupalFit commentedthe previous patch wasn't working with the branch so I created a new patch working with it.
Comment #45
micahw156The patch in #44 does not apply cleanly against 7.x-1.x, probably because of conflicts with other patches applied in the last 24 hours.
Here's yet another re-roll of the same patch against 7.x-1.x after 92b4559.
Comment #47
gaurav.kapoor CreditAttribution: gaurav.kapoor at OpenSense Labs for DrupalFit commentedAdding a function callback so that none of the strange characters are present in node title, looks like a good idea to me. Adding this to current development branch for time being. I tested it only for a single scenario and it worked fine. Please open issue again, in case this breaks anything.
Comment #49
asb CreditAttribution: asb as a volunteer commentedDoes not work for me with 'auto_nodetitle' 7.x-1.x-dev from 2019-Feb-04.
Tried the dev because I encountered the issue with replacment of a apostrophes (
'
) with'
.In my case, the complete node title is simply replaced by the string 'ant', in every node.
My "workaround" is: reverting back to 'auto_nodetitle' 7.x-1.0 from 2011-Jun-07 and trying to prevent apostrophes to be used anywhere in fields to be ppossibly tokenized.