HTML special characters in strings

MartinD - July 18, 2009 - 14:34
Project:String Overrides
Version:6.x-1.7
Component:Miscellaneous
Category:support request
Priority:minor
Assigned:Unassigned
Status:needs work
Description

I've tried to add special characters to the new string (“ and ”), but they won't get interpreted as such, that is I get the code instead of the character it represents.
Is this a String Overrides issue, or is it just not possible to pass special characters through t() at all?
___

Also, I've noticed that changes I make through String Overrides only take effect after cron is run once. Is that supposed to be that way?
___

I use Drupal 6.13 locally with MAMP.
Thanks for your answers!

#1

Rob Loach - July 19, 2009 - 16:51
Title:HTML special characters in new string; cron» HTML special characters in strings
Status:active» needs work

After making String Overrides changes, you sometimes have to clear the cache so that any cached rendered output is updated to include the new strings. The cache is emptied when you run the cron ;-) .

As for special characters, I've never tried. Which module uses the special characters? It isn't really a Drupal coding standard to use those, so you might want to move this issue over to that module and have them replaced with the normal quotes. Does it use the special character itself, or the HTML code for it? It really should just use either the normal quotes, or the HTML code.

#2

MartinD - July 28, 2009 - 14:34

All right, got that cache and cron thing, thanks!

I use String Overrides to change the Read more link that is created for the teaser of a Page (is Page referred to as a module? I don't really know).
By entering the HTML code and not the special character itself, I wanted to ensure that the character is displayed correctly in different browsers and countries.
If I enter “ in the UI, the output is “ all right, but since “ is not quite straight HTML, and because “ gets interpreted as “ (as one would expect) in the Title or the Body of a node, I thought it to be safer to use the HTML code with the string as well.

I have very little knowledge of PHP, so maybe there is some preprocessing going on which renders the user's input and the database content respectively (here: “) as “ for the browser.
I was just thinking special characters always should be written as HTML code in order to make them interpretable for everyone (and I do that all the time due to the German umlauts).

So is there a way to tell if it's safe to use the special character directly with Drupal/MySQL in general instead of their HTML codes?
Thanks again!

 
 

Drupal is a registered trademark of Dries Buytaert.