Don't delete spaces

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Scam Warning
Post Reply
What to do now
Registered User
Posts: 33
Joined: Wed Apr 09, 2008 8:33 pm

Don't delete spaces

Post by What to do now » Fri Apr 11, 2008 3:22 pm

If I type more than one space (spacebar) phpbb automatic deletes all of them but one. Is it possible to keep alle the spaces I type? Any bbcode for that?

User avatar
Erik Frèrejean
Former Team Member
Posts: 9899
Joined: Tue Oct 09, 2007 9:09 am
Location: The Netherlands, 3.0.x Support Forum
Name: Erik Frèrejean
Contact:

Re: Don't delete spaces

Post by Erik Frèrejean » Fri Apr 11, 2008 3:49 pm

This is not possible by default but:
You can set up a custom bbcode which is parsed as the html <pre> tag.
Support Toolkit | Support Request Template | Knowledge Base | phpBB 3.0.x documentation
I don't give support via PM or IM! (all unsolicited pms will be trashed!)

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51698
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Don't delete spaces

Post by Brf » Fri Apr 11, 2008 3:51 pm

It isnt phpbb deleting spaces... If you view-source on your message you will see they are still there. That is just the way webpages are shown by your webbrowser.

hithere01
Registered User
Posts: 69
Joined: Tue Jun 28, 2005 7:42 pm

Re: Don't delete spaces

Post by hithere01 » Fri Apr 11, 2008 9:56 pm

It isnt phpbb deleting spaces... If you view-source on your message you will see they are still there. That is just the way webpages are shown by your webbrowser.
Nope. Phpbb deletes extra spaces as soon as you hit submit. It will not store proper spacing without a mod.

2.0 had a "multiple spaces mod" which, as I understood it, converted any extra spaces in a post or email to & nbsp codes so the result would display properly. (and also copy and paste properly)

I assume this practice was continued in 3.0 to conserve database space by default, but it should have been established as a switchable setting. The inability to conveniently and correctly format messages can be a very serious problem.

I've asked for a mod for this functionality but none seem to be in development yet.

User avatar
Marshalrusty
Project Manager
Project Manager
Posts: 29247
Joined: Mon Nov 22, 2004 10:45 pm
Location: New York City
Name: Yuriy Rusko
Contact:

Re: Don't delete spaces

Post by Marshalrusty » Sat Apr 12, 2008 12:13 am

hithere01 wrote:Nope. Phpbb deletes extra spaces as soon as you hit submit. It will not store proper spacing without a mod.
hithere01 wrote:2.0 had a "multiple spaces mod" which, as I understood it, converted any extra spaces in a post or email to & nbsp codes so the result would display properly. (and also copy and paste properly)
Those two statements contradict each other. phpBB "deletes extra spaces as soon as you hit submit" and yet you need a MOD to convert every other space into &nbsp;, how does that make any sense?
__________________________________________________________________________________________

As Brf clearly stated, phpBB does not remove spaces, your browser just doesn't display them. If you need something shown exactly as you typed it, then use the code tags.

Code: Select all

word                       word
Aha, multiple spaces! And if we look at the source:

Code: Select all

<code>word&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;word</code>
So in other words, if you use the code tags, it does exactly what the phpBB2 MOD did. If you don't use code tags, then this is not done.
__________________________________________________________________________________________
hithere01 wrote:The inability to conveniently and correctly format messages can be a very serious problem.
I say again: code tags.
__________________________________________________________________________________________

I'd like to also ask that you do not "accuse" us of doing something without first checking the code to make sure you're correct. We don't take kindly to false accusations here.
Have comments/praise/complaints/suggestions? Please feel free to PM me.

Need private help? Hire me for all your phpBB and web development needs

hithere01
Registered User
Posts: 69
Joined: Tue Jun 28, 2005 7:42 pm

Re: Don't delete spaces

Post by hithere01 » Sat Apr 12, 2008 12:38 am

Those two statements contradict each other. phpBB "deletes extra spaces as soon as you hit submit" and yet you need a MOD to convert every other space into &nbsp;, how does that make any sense?
They do not contradict each other. I don't understand why you think the word "contradict" applies here. Removing spaces when submitting and failing to properly convert them to & nbsp is exactly what phpbb has always done. Hence the need for a mod. Having installed such a mod, I should know that it both is required and still required to get this to function properly (e.g consistently) in phpbb 3.
I say again: code tags.
__________________________________________________________________________________________

I'd like to also ask that you do not "accuse" us of doing something without first checking the code to make sure you're correct. We don't take kindly to false accusations here.
1. The fact that you regard code tags as an appropriate solution demonstrates that you wholly misunderstand the problem. In this case it's equivalent to asking people to use bbcodes every single time they want to capitalize a letter.

2. In your haste to be, um, helpful? you have misunderstood the problem. phpbb3 DOES NOT PROPERLY STORE SPACES. Try posting with a 5 space introduction to setup a paragraph. Submit. See results in browser, or attempt to edit.
A. note that spaces are not properly (consistently) stored.
B. note that spaces are not properly displayed, because phpbb3, in it's improper storage, does not submit the characters to the browser in the same fashion as they were stored. (If they were properly stored then I clearly would not see different results typing in the browser whether preparing a post or looking at it after submitting)

Now you can make the ridiculous argument that this is some kind of "browser" or "recall" problem and not a storage issue, but no reasonable person would conclude that my typing 5 spaces, a word, 10 spaces, and another word, should result in word-space-word afterwards. Obviously that wasn't the intention of the person writing the post, ergo, phpbb does not properly store spaces. If this was a "browser" fault of some kind then why would it display the post pre-submit properly?

That's is simply nonsensical. You are not understanding the problem, probably because most forums, including this one, totally disregard post formatting. It's not an issue for the types of postings made, but on many other forums we require that precise spacing be maintained per the users input.

(and fyi that isn't a "browser" issue, it's a html issue, an issue caused by improper storage, though to be more accurate, it's also due to phpbb failing to properly write out the expected html view page)

attn What to do now -
This is possible and eventually someone will recreate the 2.0 multiple spaces mod so it is properly adapted for 3.0

User avatar
Phil
Former Team Member
Posts: 10403
Joined: Sat Nov 25, 2006 4:11 am
Name: Phil Crumm
Contact:

Re: Don't delete spaces

Post by Phil » Sat Apr 12, 2008 3:19 am

phpBB3 does trim spaces at the beginnings and end of a post. That's it. Otherwise, feel free to try it.
word word
In the HTML source, there is are five spaces between those two words. The broswer is not rendering it.
Edit: This is the source for my post. See?

Code: Select all

<div class="content">phpBB3 does trim spaces at the beginnings and end of a post. That's it. Otherwise, feel free to try it.<br />word     word<br />In the HTML source, there is are five spaces between those two words. The broswer is not rendering it.</div>
Again, before making false accusations, please verify the accusations you are making.
Moving on, with the wind. | My Corner of the Web

User avatar
Marshalrusty
Project Manager
Project Manager
Posts: 29247
Joined: Mon Nov 22, 2004 10:45 pm
Location: New York City
Name: Yuriy Rusko
Contact:

Re: Don't delete spaces

Post by Marshalrusty » Sat Apr 12, 2008 6:04 am

hithere01 wrote:They do not contradict each other. I don't understand why you think the word "contradict" applies here.
The two statements contradict each other because phpBB cannot convert spaces that are presumably removed when the form is submitted. How can the code possibly convert multiple spaces to display properly if they are gone before the post is even stored, as you say. Here, you say it yourself:
hithere01 wrote:Removing spaces when submitting and failing to properly convert them to & nbsp is exactly what phpbb has always done.
I say again: The way phpBB "stores" posts has no bearing on the multiple spaces being displayed or not. The emulation that takes place in that MOD or when using the code tags in phpBB3 is done when preparing the post for display. The spaces themselves are stored in the database just as you post them and there are a bunch of methods to prove this.
1) Make a new post with multiple spaces.
2) Submit it. (this is when you say the spaces are removed).
3) View the post and confirm that the spaces do not display.
4) View the source of the post. See the spaces there? (the right answer is 'yes')
5) Edit the post. See the spaces in the text box? (again, the right answer is 'yes')
6) Use a tool such as phpMyAdmin to find the post in the posts table. See the spaces there? (yet again, the right answer is 'yes').

So now, if the spaces are not being stored properly, how is it that they are there when you edit the post and in the source and in the database? If they're not stored properly, how does phpBB know where they were when you edit the post?

Still don't believe me? Create a test.html file with the following code:

Code: Select all

<table><tr><td>word                word</td></tr></table>
Now run the file using your browser, do you see the spaces? No, because that's not how browsers parse multiple spaces. This isn't a bug in the browser at all, and nowhere did I imply that it was.

There is a very big difference between "removing spaces from posts" and simply not emulating multiple spaces to display the intended way. For example, phpBB does prevent HTML from being parsed. That is to say, if the code did not actively prevent HTML, any HTML would be processed and displayed. The spaces, on the other hand, are not changed in any way: just displayed exactly the way you typed them. The way this is displayed by your browser, however, is with one space. Also note that this is not at all a "bug" in the browser, but purely intended behavior. As has already been said, looking at the page source will show that all spaces are there, but are not being displayed in your browser. If you find the post's entry in the database, all the spaces are there. The way to get the spaces to display is to replace every other one with &nbsp; (which is done when preparing the post for display). That has nothing to do with "storing them properly" and everything to do with emulating the intended behavior (which is only done when the code tags are used). Sure, the code could do it, and you could even argue that it should do it, but that's very different from purposely breaking something that would otherwise work.

If you are so sure that phpBB removes spaces on purpose, then post the code that does this.
Have comments/praise/complaints/suggestions? Please feel free to PM me.

Need private help? Hire me for all your phpBB and web development needs

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51698
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Don't delete spaces

Post by Brf » Sat Apr 12, 2008 10:38 am

Phpbb3 does too store the spaces. If you quote my message from above, you will see the extra spaces I inserted between the words"by" and "your". The extra spaces show in your posting window, but do not show in your webbrowser for the message because HTML rendering suppresses extra spaces.

Code: Select all

[quote="Brf"]It isnt phpbb deleting spaces... If you view-source on your message you will see they are still there. That is just the way webpages are shown by                          your webbrowser.[/quote]

Post Reply

Return to “phpBB Discussion”