Hi,
I'm coming from FileField Paths' issues queue:
#542974: Cleaning FileField Path and Filename: single quotes are replaced by 039
I don't quite understand my issue and where should I ask for help, but here it goes:

http://drupal.org/node/542974

When creating a FileField, I've checked in "File path cleanup settings" and "File name cleanup settings":
- Cleanup using Pathauto.
- Convert to lower case.
- Transliterate.

The problem is that when filename contains a single quote ('), it is replaced by "039" when it should be replaced by Pathauto's separator (-).
Such problem doesn't occur when pathauto aliases node titles so I think it's only related to FileFields.

http://drupal.org/node/542974#comment-3249904

I changed from [title] to [title-raw] and it works now for the title. But I cannot find the token -raw for the filefield description, so when I put this, single quotes are replaced by 039:
[title-raw]-[filefield-description].[filefield-extension-original]

Is there any -raw token for the description?
Or how to avoid 039 and other similar replacements?

http://drupal.org/node/542974#comment-3466606

Filefield Paths only takes care of paths and file names.
Your issue, which I also encounter, is certainly related to Imagefield Tokens.

Thank you

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Pomliane’s picture

Same issue here.

Pomliane’s picture

If J0nathan and I are the only one having this issue it might not be the good queue...

Sorry, but I'm a bit lost between FileField, File(Field) Paths and ImageField Tokens potential involvement in this...

Could anyone please show the right direction? :)

13rac1’s picture

Status: Active » Postponed (maintainer needs more info)

It has been a long time, have you corrected this issue?

Pomliane’s picture

Unfortunately no, the problem remains.

13rac1’s picture

Category: support » bug
Status: Postponed (maintainer needs more info) » Active
Sinan Erdem’s picture

Version: 6.x-1.0 » 7.x-1.x-dev
Sinan Erdem’s picture

Status: Needs review » Active

Solved the special characters issue by adding these two lines:

	    $field_data['title'] = htmlspecialchars_decode($field_data['title'], ENT_QUOTES | 'ENT_HTML401');
	    $field_data['alt'] = htmlspecialchars_decode($field_data['alt'], ENT_QUOTES | 'ENT_HTML401');

just after those lines in imagefields_tokens.module file:

            // Truncate fields to max allowed length. alt=512, title=1024 per image.install
            $field_data['title'] = truncate_utf8($field_data['title'], 1024, TRUE, TRUE);
            $field_data['alt'] = truncate_utf8($field_data['alt'], 512, TRUE, TRUE);

Sorry, too lazy to submit a patch...

Sinan Erdem’s picture

Status: Active » Needs review
13rac1’s picture

Only set "Needs review" when there is a patch available.

sunfire-design’s picture

Status: Active » Patch (to be ported)
FileSize
758 bytes

Changes in #7 works great.

I attach a patch for the changes.

Pomliane’s picture

Very simple solution working even for D6 with small changes.

The time it took to emerge raises questions: is this module really Actively maintained and Under active development?

Anyway thank you Sinan Erdem!

13rac1’s picture

Status: Patch (to be ported) » Needs review

Patch (to be ported) is for when and existing patch has already been applied to a branch.

Pomliane, I know I haven't added much substance to this conversation, but this is as much time as I've got. I don't have an existing project using this module, so creating/debugging/testing/documenting it gets heavily delayed. I've got other projects, my job (where I fit in maintaining as much as reasonable), and try to have a life off the computer. There isn't enough time in my life to constantly work on all of these Drupal projects.

Thanks for figuring it out Sinan.

Thanks for the patch sunfire-design. I'll apply the changes, but I cannot directly apply the patch, because it you've used tabs instead of spaces. In the future, please make sure patches follow the Drupal coding standards.

Pomliane’s picture

eosrei, I have strictly no issue with your involvement of course, how could I? :)

But, I think that, to be useful, maintenance/development statuses of your module should be updated accordingly... or, maybe, a co-maintainer could help you?

sunfire-design’s picture

Sorry for the tabs.

New one attached.

BWPanda’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

I was experiencing this problem with both quotes (') and ampersands (&) in my node titles. The patch from #14 fixed the issue for me (after re-saving all my nodes).

nodecode’s picture

#14 fixed the issue for me too. It's super simple code. I also tested with a bunch of other special characters and it was great. +1 RTBC.

cmseasy’s picture

Bumped into the same issue and used the patch succesfull. Please commit.

northseattlewebmaster’s picture

I'm having the same issue trying to use an apostrophe in Drupal 6. Please help..

northseattlewebmaster’s picture

I'm having the same issue trying to use an apostrophe in Drupal 6. Please help..

millionleaves’s picture

This patch does the trick, but won't apply if you've already applied the patch here (and vice versa): https://www.drupal.org/node/1889772#comment-10078632

I was able to manually add the two new lines from this patch to my version which included the above patch, and it solved my problem. Happy to post a new version of this patch which takes account of the above patch being applied first, but I don't want to confuse things.... I'll also add a comment to the other queue.

NWOM’s picture

#14 works great. Thanks!

ysamoylenko’s picture

Issue tags: +epam-contrib-2019.03

ysamoylenko’s picture

Status: Reviewed & tested by the community » Fixed

The patch was committed. Thanks for your testing.

ram4nd’s picture

Issue tags: -epam-contrib-2019.03

Status: Fixed » Closed (fixed)

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