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 ?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vstmusic’s picture

Please, no idea ?

fago’s picture

Status: Active » Postponed (maintainer needs more info)

For me both characters look equal?

Witch’s picture

I have problems mit the "&" chars in taxonomy terms + autonodetitle. It will display a ""&"

Can you look into it?

apaderno’s picture

Title: Stange translation of a spacial character in the title ! » Strange translation of a spacial character in the title
Status: Postponed (maintainer needs more info) » Active

I 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()?

Witch’s picture

Oh sorry, "&" appears as &

How can i check this, kiam?

fago’s picture

Category: bug » support
Status: Active » Fixed

As noted in the description text, you should use raw tokens. If the token is raw, the characters are displayed correctly (= check_plained() once).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Nchase’s picture

Status: Closed (fixed) » Active

reopening 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?

apaderno’s picture

Status: Active » Closed (fixed)

Is this tean a token issue or a locations issue?

It is an issue of the module that provide the extra tokens without to provide a raw version.

johnv’s picture

Title: Strange translation of a spacial character in the title » Strange translation of a special character in the title
Version: 6.x-1.2 » master
Status: Closed (fixed) » Active

I 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?

johnv’s picture

Version: master » 7.x-1.x-dev

wrong version.

johnv’s picture

Status: Active » Closed (won't fix)

For future reference, I have solved it like this:
My field 'field_name' = 'foo&bar'.
Using token [node:field-name], the result is 'foo&ampbar'. (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'];

Yuri’s picture

#12 not working for me. The ' and & still show as ' and &amp.
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.

andrew@oscailte.org’s picture

Drupal 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.

GaëlG’s picture

Status: Closed (won't fix) » Active

#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.

tusharbodke’s picture

Hi 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.

ZeiP’s picture

Status: Active » Needs review
FileSize
1.05 KB

I 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.

Ivanhoe123’s picture

#12 worked for me with apostrophes and ampersand characters

Thanks!

blattmann’s picture

The patch in #18 does not seem to work for ampersands or apostrophes for me.

cangeceiro’s picture

FileSize
1.19 KB

the patch in #17 didnt work for me, here is a revision of that patch that did resolve the issue for me

jenlampton’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
1.19 KB

This 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

jenlampton’s picture

Category: support » bug

Oh, I also think this was a bug in the original design.

bisonbleu’s picture

Patch 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!

Andrew_Mallis’s picture

Status: Reviewed & tested by the community » Needs review

Patch 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:

<?php 
  $subject = '[node:field_lecture_subject]';
  //$subject = $node->field_lecture_subject[$node->language][0]['value'];
  $number  = 'missing-lecture-number'; // set a default
  $number  = '[node:field_lecture_number]';

  if(empty($subject)) {
    return("lecture #" . $number ); 
  } 
  else { 
    return($subject);
  }
?>
sjohnson’s picture

jenlampton — your patch worked for me; thank you!

cafuego’s picture

The 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.

cafuego’s picture

Status: Needs review » Reviewed & tested by the community

Argh, bump status.

venutip’s picture

Just 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.

vinmassaro’s picture

The 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:

vm-mbp:tmp vincentmassaro$ git clone --branch 7.x-1.x http://git.drupal.org/project/auto_nodetitle.git
Cloning into 'auto_nodetitle'...
remote: Counting objects: 287, done.
remote: Compressing objects: 100% (151/151), done.
remote: Total 287 (delta 165), reused 223 (delta 130)
Receiving objects: 100% (287/287), 58.65 KiB | 0 bytes/s, done.
Resolving deltas: 100% (165/165), done.
Checking connectivity... done
vm-mbp:tmp vincentmassaro$ cd auto_nodetitle
vm-mbp:auto_nodetitle vincentmassaro$ git am ~/Desktop/auto_nodetitle-dont_double_escape_titles-565922-29.patch
Applying: Decode entities (patch from https://drupal.org/node/565922#comment-7792773)
fterrier’s picture

Issue summary: View changes

Patch in #29 worked for me.

mlncn’s picture

The 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?

mvc’s picture

worked for me as well. i remember having to apply a similar patch in D6 for this module, too :/

stephesk8s’s picture

Patch #29 worked for me. Thank you.

botris’s picture

Priority: Normal » Major

Confirming that patch #29

berliner’s picture

Confirming 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.

berliner’s picture

Anyone looking for a patch that applies to 1.0-stable see attached.

esteinborn’s picture

Confirming Patch #29 works to remedy the problem.

Tess Bakker’s picture

Status: Reviewed & tested by the community » Needs work

html_entities_decode() in the patch is not UTF-8 proof. It should use decode_entities().

cafuego’s picture

Status: Needs work » Needs review
FileSize
1.04 KB

Updated patch, now using Drupals decode_entities() which wraps an UTF8 safe html_entity_decode() call.

SpadXIII’s picture

Patch looks alright, but I'd rather see the token module fully respect the sanitize-flag.

For field-values, the sanitize-flag is completely ignored. :(

Tess Bakker’s picture

achap’s picture

Patch 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.

micahw156’s picture

+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.

Utkarsh_Mishra’s picture

the previous patch wasn't working with the branch so I created a new patch working with it.

micahw156’s picture

The 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.

gaurav.kapoor’s picture

Status: Needs review » Fixed

Adding 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

asb’s picture

Does 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 &#039;.

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.