Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: ' (or & # 3 9 ;) in your new article will fail to process  (Read 6702 times)

Jochum Meester

  • Sr. Member
  • ****
  • Karma: 1
  • Posts: 309
    • JochumMeester.com
' (or & # 3 9 ;) in your new article will fail to process
« on: April 21, 2007, 12:27:40 AM »

I've set my charset to iso-8859-1 and whenever I want to add an article that has an apostrophe:
'
or in ascii (without the spaces):
& # 3 9 ;
whenever it has that one in it, I submit but then my whole post gets lost!

Does anyone else have this problem? Isn't snews.php supposed to change this into the ascii code automatically?

Edit: it also doesn't work in comments...
« Last Edit: October 18, 2008, 06:27:48 AM by philmoz »
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
' (or & # 3 9 ;) in your new article will fail to process
« Reply #1 on: April 21, 2007, 12:35:40 AM »

nope, and I'm sure there's a good reason for that. The apostrophe is a control character in PHP for example, so using it in a title is not a good idea. Try using a single typographical quote instead... (like this: .) HTML code is
Quote
’ or &_#8217
(The underscore is just there to show the code, PunBB converts the numerical entity to the quotemark!)

The best way (afaik anyway) is to use UTF-8 throughout (including in dbase collation setting _and_ for your editor's preferences), and use your designated key on the keyboard for the single "curly" quote.
This just my 2 fwiw.
Logged

Joost

  • Guest
' (or & # 3 9 ;) in your new article will fail to process
« Reply #2 on: April 21, 2007, 07:08:01 AM »

If  phpinfo.php shows :  
Code: [Select]
   magic_quotes_gpc Offinsert in .htaccess the following line:
Code: [Select]
php_flag magic_quotes_gpc onSecurity is involved here, so check in phpinfo.php if  magic_quotes_sybase is disabled (off or 0)
if not, add to .htaccess the following line also:
Code: [Select]
php_flag magic_quotes_sybase offThis worked for me.
« Last Edit: October 18, 2008, 06:28:05 AM by philmoz »
Logged

Jochum Meester

  • Sr. Member
  • ****
  • Karma: 1
  • Posts: 309
    • JochumMeester.com
' (or & # 3 9 ;) in your new article will fail to process
« Reply #3 on: April 21, 2007, 10:48:04 AM »

I'll try utf-8 first, if it doesnt work I'll use either of your advice! It's just that that apostrophe is standarized on my keyboard (you'll know Joost), and I came up with this when my dad tried to add an article with apostrophes and it didn't work, and I can't tell him to use the html code cause he's what you'd call a real noob :)
Thanks to both of you!
Logged

Jochum Meester

  • Sr. Member
  • ****
  • Karma: 1
  • Posts: 309
    • JochumMeester.com
' (or & # 3 9 ;) in your new article will fail to process
« Reply #4 on: April 22, 2007, 04:22:40 PM »

With UTF-8 it doesn't work either. I tried your solution Joost and I got an 500 internal error (both were set at 'off' in phpinfo).

Is there a way to change the key on my keyboard so that it doesn't write the apostrophe I have now but a curly one?
Logged

Joost

  • Guest
' (or & # 3 9 ;) in your new article will fail to process
« Reply #5 on: April 22, 2007, 05:51:32 PM »

So configuring your ini settings isn't allowed, I guess I am kind of lucky I can.
I have no answers left, only a temporary workaround:
To produce one single quote mark, insert two single quote marks (hit the key twice). Only the second one will automatically end up (escaped) in de database and will be produced, whenever a page is called for. So,
's avonds should be entered as ''s avonds (2 times a single quotemark)

Major drawback of this workaround is: Whenever you want to edit an existing page, you have to add an extra single mark quote to every single quote mark, found in the text.
Logged

Jochum Meester

  • Sr. Member
  • ****
  • Karma: 1
  • Posts: 309
    • JochumMeester.com
' (or & # 3 9 ;) in your new article will fail to process
« Reply #6 on: April 22, 2007, 06:13:07 PM »

Hmm too bad, thanks for the help anyway!
Perhaps there's a javascript thingy that will change ' to    & # 3 9 ;    as you type (like the sef url).
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
' (or & # 3 9 ;) in your new article will fail to process
« Reply #7 on: April 22, 2007, 06:35:19 PM »

Jochum -- with utf-8 as the character set, you have to use the proper key combination to get the curly quote, using the normal apostrophe key will _always_ produce an apostrophe no matter what charset you use...

Key combo for curly quotes differ between operating systems and keyboard setups. I use Mac OS X with the keyboard setup Swedish Pro. That setup allows me to use the key combo alt+m to produce a single right curly quote (equals ’). If I want a double right curly quote I use the combo shift+alt+m.

I can't tell you exactly which key combo you need to use to get the single curly quote, because it depends on your operating system, language setting and keyboard setup (if your operating system allows those variables to be set). So to get utf-8 to produce single curly quote marks, you need to find that key combination.

As always, this "advice" is based on my own experience. YMMV.
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
' (or & # 3 9 ;) in your new article will fail to process
« Reply #8 on: April 22, 2007, 06:35:47 PM »

search forum for mime_magic_quotes (I think)

In some cases, if server is set up with them off??on?? (one of those) then apostrophes screw things....

A solution was posted here somewhere.
try this

http://www.solucija.com/forum/viewtopic.php?id=2594
Logged
Of all the things I have lost, it is my mind that I miss the most.

Jochum Meester

  • Sr. Member
  • ****
  • Karma: 1
  • Posts: 309
    • JochumMeester.com
' (or & # 3 9 ;) in your new article will fail to process
« Reply #9 on: April 23, 2007, 01:28:58 PM »

I thought in a previous version there was a HTML to entities thingy or something like that, that changed it. Is that script not in sNews anymore?

EDIT: Something like this:
http://www.javascriptkit.com/script/script2/htmltoentities.shtml
but then it would change it as you type, or submit, or something like that?
Logged

Joost

  • Guest
' (or & # 3 9 ;) in your new article will fail to process
« Reply #10 on: April 23, 2007, 06:56:08 PM »

Quote from: JochumMeester
I thought in a previous version there was a HTML to entities thingy or something like that, that changed it. Is that script not in sNews anymore?
I think you mean htmlentities() or htmlspecialchars(). No, a lot of the code has been rewritten. When sNews was updated from 1.5.30 to 1.5.31 the changes were huge and sNews gained more then 30kb of weight. This was a major security fix. I don't recall if the single quote mark bug was introduced there or before. Anyway, they had to act quickly. 1.5.31 still has some minor bugs, like the Math Captcha [url]bug. You have to fix it yourself.

In an utopic world, the next sNews, will be bug free and have all the features we ever dreamt of ;)
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
' (or & # 3 9 ;) in your new article will fail to process
« Reply #11 on: April 28, 2007, 02:25:51 PM »

There is another solution to this one.
Logged

Joost

  • Guest
' (or & # 3 9 ;) in your new article will fail to process
« Reply #12 on: April 28, 2007, 05:10:37 PM »

Quote from: codetwist
There is another solution to this one.
Looks very good Codetwist and it is helpful for a lot of sNews users. But I am glad I can enable get_magic_quotes_gpc. This fix goes way beyond my copy/paste skills. :)  So I wait for a bugfix in the next sNews

Regards,
Logged