Calc element and quote character

jfquestiaux

Well-Known Member
I can't seem to record a string containing a " ' " in it, even if I use htmlspecialchars or htmlentities (with ENT_QUOTES).

Is there a way to record such string as "L'Atelier"?
 
Well, I tried
Code:
return addslashes('{artists_details___studio}');

but it returns "L'Atelier" and not "L\'Atelier", so I don't know what else to do.
 
very odd, its a long shot, but could you confirm that its the single quote " ' " that you are entering and not the character " ` "? Thats the only thing I can think of at the moment
 
Yes, it is the regular ' character. Maybe it has something to do with Frenc being the default language for the site (although I don't see how)?
 
Ooops.

That last one was me. For some reason, FireFox keeps logging me in a 'buildit', which was an account we used for testing the new forum / jFusion / J! loging stuff with. I've cleared every cache and removed every cookie I can think of, but it still keeps doing it.

-- hugh
 
OK, I had an intuition and actually that solved the issue: I was using a basic code to concatenate firstname/lastname, so I used
PHP:
return '{artists_details___firstname}' . ' ' . '{artists_details___lastname}';
For a guy named "Jean D'upont", and with "Calc only on save" set to "No", the correct name was showing in the list view but nothing was recorded into the database (even after saving the record).

If I set "Calc only on save" to "Yes", then nothing shows in list view and nothing is recorded, even after saving the record.

So in fact, when you might have a single quote in the returned string, you MUST use double quotes in the code:
PHP:
return "{artists_details___firstname}" . ' ' . "{artists_details___lastname}";

This works fine. I guess if you might have double quotes in the string, it is back to single quotes in the code, and if you might have both... I don't know what you can do!
 
OK, as per our Skype conversation, when I finally engaged my brain, this is an artifact of our placeholder processing. As we do the replacement on your code fragment before we run it, handling quotes is problematic, as none of us know what quotes you will be using or what the data will contain. So basically, you can't use placeholders where there might be quotes.

So you'll have to use $data[] instead.

PHP:
return $data['artists_details___firstname]. ' ' . $data['artists_details___lastname'];

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top