special characters converted in html entities

guix - December 30, 2008 - 16:27
Project:Glossary
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Hello,

The glossary links are not added in the node page on words that have special characters, if these special characters are converted into html entities like they should, for example with a WYSIWYG editor like FCKeditor.

Example :
- in the vocabulary "Glossaire" I have a term "atmosphère"
- in a node body I enter somewhere "atmosph&eagrave;re" (plain text editor) or "atmosphère" in a WYSIWYG editor and the editor converts it into "atmosph&eagrave;re"
- the glossary link is not added on "atmosphère" when viewing the page, because in fact in the source code it is "atmosph&eagrave;re" and the glossary filter is looking for "atmosphère".

I tried to create the html entities converted term instead of the plain term with special characters, but it's not nice since in the glossary page, the output is the html entities code (example : the output in the glossary page is "atmosph&eagrave;re" and not "atmosphère".

Another solution would be to disable the html entities conversion of special characters in the WYSIWYG editor. It's possible with FCKeditor, but it's not very standards friendly.

I think the best solution would be if the glossary filter could look, for each term, for the real term (special characters) and for the html-entitified term. Do you agree with that ?

#1

guix - December 31, 2008 - 17:29
Status:active» needs review

Here's a patch that does the job with extra code inside _glossary_get_synonyms.

If no WYSIWYG editor is installed (from the list fckeditor, tinymce, htmlbox, jwysiwyg, yui_editor, to be continued), then _glossary_get_synonyms does its job as usual.

If there is one, we're assuming the textarea will convert special characters to htmlentities, and that we need to have some kind of virtual synonyms :

école -> virtual synonym of école

The query has to be splitted into two recursive queries :
1) Fetch the terms of the vid and look if they have special characters. If yes, add the htmlentities version as a synonym.
2) Check if the term has any (real) synonyms. If yes, add the synonym. Then if the synonym has special characters, add the htmlentities version as well

It's my first patch that adds a feature in Drupal, I hope it's not too ugly. Maybe the feature should be chosen as an option in the glossary settings, but I believe that the automatic triggering if any WYSIWYG editor is installed is better.

AttachmentSize
glossary-352545-1.patch 2.64 KB

#2

guix - March 3, 2009 - 18:19

Hello,

What about that patch ? Would you be willing to integrate it if I update the patch to the latest dev ?
For now, Glossary is useless with a lot of languages and WYSIWYG editors.

See you
Guix

#3

seren10pity - March 12, 2009 - 09:46

Thank you very mutch for this patch !!!

I'm french, I just created a new website, and I had the problem with the htmlentities conversion that were not understood by Glossary...

I just added the 'wysiwyg' module in the ' if condition ' of your patch ; and it rocks !

Thanks again ;)

#4

guix - March 12, 2009 - 09:57

Thanks ! I'll add wysiwyg to a new patch against -dev if I get a positive review by Moshe.

#5

guix - June 30, 2009 - 06:50

Bump, Nancydru would you like me to roll a new patch ?

#6

milos1234 - June 30, 2009 - 22:38

guix - please, that would be really helpful thanks!

i am using the current stable version, with a few modifications to get multi-language working properly. but am having much troubles with special characters in the other languages in the synonyms.

thanks!!

#7

guix - July 2, 2009 - 16:39

I don't know which source to patch against, HEAD is still 5.x. DRUPAL-6--1 ?

 
 

Drupal is a registered trademark of Dries Buytaert.