SMF 2.0 RC3 spaces in code blocks are mangled

Started by boardhead, August 12, 2010, 09:33:46 AM

Previous topic - Next topic

boardhead

When posting, pairs of spaces in the post text are converted to "  ", which is usually fine.

The problem is that this conversion also occurs inside code blocks, which is unnecessary (because code blocks are "nowrap" anyway), and results in compile errors when code is cut-and-pasted from some browsers (ie. Safari).

I have looked at the SMF PHP code and tried to fix this myself, but was not successful.

Please, someone submit a patch to avoid this translation of spaces in code blocks.

Thanks in advance.

- Phil

Ashley S


boardhead

Quote from: Ashley S on August 12, 2010, 10:52:46 AM
It works fine with Firefox.

This is a non-answer.

The fact is that SMF changes spaces in code blocks to non-breaking spaces, which is wrong.

Presumably if it works in Firefox it is because Firefox isn't copying the special characters properly and is converting non-breaking spaces back to spaces.

Acans

Hi boardhead,

Altho this sounds like a bug, SMF 1.1 no longer gets bug fixes with the new releases, they are security fixes only. This way all the new work goes towards 2.0 to get it to 2.0 final.

Would you like me to move this to 1.1.x Support, i think you will get better support their than the bug's board.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

boardhead

Quote from: α¢αηѕ on August 13, 2010, 04:45:16 AM
Altho this sounds like a bug, SMF 1.1 no longer gets bug fixes with the new releases, they are security fixes only. This way all the new work goes towards 2.0 to get it to 2.0 final.

Would you like me to move this to 1.1.x Support, i think you will get better support their than the bug's board.

Well, if I can't get this fixed in 1.1, it would be good if this bug was fixed in 2.0.  So consider this a SMF 2.0 request then.

Acans

Have you tried this on an installation of SMF 2.0 yet?

You can try it in the test board on this forum, than reply to see if the bug is global across the versions.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

boardhead

Good point

    this is some      test text with       spaces

boardhead

Yes.

I can confirm that the spaces are mangled with SMF 2.0 RC3

So consider this a SMF 2.0 bug report.

Thanks.

- Phil

Acans

I've updated the topics title and icon. I'm looking for some feedback from the Developers/beta testers before it get added to the bug tracker.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

boardhead

Thanks.  To verify this problem, all you need to do is look at the source for this page.  You will see that the code in my post above gives the following HTML:

    this is some      test text with       spaces

- Phil

Nibogo

I can confirm it however I can't see what is wrong with this, could you tell me why this should be fixed?

As someone said everything (including copy/paste) works great with Firefox (haven't checked with other browsers).

live627


boardhead

This IS a bug for the reasons I have mentioned:

1) It doesn't matter if it works with Firefox because it doesn't work with Safari, and lots of people use Safari.

2) It is technically wrong because code blocks should be verbatim.

3) It is unnecessary because code blocks are nowrap anyway.

Also, it should be relatively simple to patch this problem.

- Phil

Jscripts

Test IE8 WinXP32

this is some      test text with       spaces

Works OK - I wonder if Safari is the one adding the nbsp within the paste command?

boardhead

Quote from: Jscripts on August 24, 2010, 10:51:17 AM
Works OK - I wonder if Safari is the one adding the nbsp within the paste command?

No.  Look at the page source.  I can also point you to the PHP in SMF which adds the nbsp's.

boardhead

I really don't see the problem in recognizing this bug.  It is the single largest complaint I have, and is a very big deal since I post a lot of code samples in my forum and many of the forum members are running OS X.

As I said, the solution is quite simple.  I even coded up a solution myself, but it was my first attempt at PHP and I couldn't get it to work properly, so I would rather see an official solution to this problem.

- Phil

Advertisement: