1

Topic: Non breakable space : how to ?

Hello all,

is there some way to get non breakable space in posting ?
I mean, the space before ? ; ! and so so («»??...)

Thanks,
abclf.

Re: Non breakable space : how to ?

Sure, just hit space four times in the textbox. Like this:

    there are four spaces to the left of this text

You can't start a post with spaces though as they will be trimmed when the post is put in the database.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3 (edited by abclf 2005-11-18 01:38)

Re: Non breakable space : how to ?

Hello Rickard,

Thanks for replying, but I think I may have been misunderstood. If I'm not mistaken (if I'm right), you told me that I can hit multiple spaces, which are not reducted to a single one when saved in the database, true ?

But, what I mean is : how to make non breakable space ?   in html dialect or ctrl+space in word.
For example, how forcing the interrogation point (?) to be attached-like to the word before when there is a space between (example : how do you do ?).
In France, typographic rules need a space before ? ; ! :.
Do you seen what I mean ?
See infra (with FF) : the ? is alone on a new line.

teste etst etst etstetstst uuu zetytyze yezyez ezyeezye ezye zyetzy ezyez uu u uu uu uuuu yeyz ezyezyezyezh hh hhhhuuu zeyezy ?

4

Re: Non breakable space : how to ?

So basically...

Bad:

How are you?

Good:

How are you ?

Why do you need/want to force that?

Re: Non breakable space : how to ?

I understand. You don't want to line to break between those characters and the last word. It's difficult. Most other languages "forbid" any whitespace between the last word and any punctuation.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

6

Re: Non breakable space : how to ?

Elzar wrote:

Why do you need/want to force that?

Because it is the proper way to use ponctuation, at least for french.
The rule is : one space (after) for single sign (. ,) ; double space (one after + one before) for double sign ( ; : ! ?)

Here is the rule (see colon, semicolon and so on) :

This is about standard usage of spaces before/after colons and the like, not about fonts. Unless specified otherwise, the following typography rules apply to French, English and German.

Two examples:
    En français: Einstein a (peut-être) dit : « J'adore 3,14, 298 000 ? et 42 ! ».
    In English: Einstein said: "3.14, 298,000?and 42?are my all-time favourite numbers!" (or maybe he didn't.)

Comma, full stop, ellipsis: , . ...
      No space before, one space after. English usage may use two spaces after a full stop or an ellipsis.

Colon, semicolon, question mark, exclamation mark: : ; ? !
      French: one nonbreaking space before, one space after. The rule is that there are as many spaces as there are elements in the punctuation mark. For example, a colon is surrounded by two spaces because it contains two elements (two dots); a comma contains only one element, therefore it is surrounded by one space (after).
      English, German: no space before, one or two spaces after. Two spaces may be necessary with monospaced fonts, but only one space is used in standard typography.
      In my opininion, the French rule is a little more readable, but it is often inconvenient with computers because because not every software handle nonbreaking spaces properly.

source. http://everything2.com/index.pl?node_id=1010198

So, impossible ? tricky ? and what about «hacking» the parser ?

7 (edited by ghotistix 2005-11-18 19:48)

Re: Non breakable space : how to ?

Most word processors let the user hit ctrl-shift-spacebar to add a non-breaking space. It's useful for when style guidelines require spaces between periods in ellipses, i.e. " . . . "

It doesn't look like it's a feature in HTML forms, but it might be possible in javascript if one were so inclined.

8

Re: Non breakable space : how to ?

Rickard wrote:

I understand. You don't want to line to break between those characters and the last word. It's difficult. Most other languages "forbid" any whitespace between the last word and any punctuation.

I don't know how is processed exactly BB code, but: is it possible to imagine using a BB code like "[ ]" (space between [ and ]), substituted by   ?

9

Re: Non breakable space : how to ?

Special BBCode too heavy to use, imho, not natural, not convenient smile
Don't know if there is a quick solution anyway, and I don't know how javascript may give non-breakable space.
More, somethong more friendly should be better.
I know there is some script to transform plain text ponctuation in html entities but don't know if it may be usefull here (to my mind, no smile) and too difficult to hack for me (here is the url on one well known script, http://www.michelf.com/projects/php-smartypants/)

Re: Non breakable space : how to ?

how about just make a double space a  ?

11 (edited by gil 2005-11-19 14:36)

Re: Non breakable space : how to ?

Connorhd wrote:

how about just make a double space a  ?

I think that (like a [ ] BB code), it can be convenient for seldom usage, but not useful courant one: it should be an automatic processing for a french forum.
Why not substituting in content of posts the blank space of all "[any character except space] [;:?!]" patterns by a " "? Not difficult with Perl, but I don't know php. Useful for french language, and doesn't matter for others (and this specific pattern should not be used).

12

Re: Non breakable space : how to ?

gil wrote:

Why not substituting in content of posts the blank space of all "[any character except space] [;:?!]" patterns by a " "? Not difficult with Perl, but I don't know php. Useful for french language, and doesn't matter for others (and this specific pattern should not be used).

I agree smile
I tried using the censor words tool but I can't force a   space to be printed in the place of a normal space.
Do somebody have a quick solution ? May I change something in the parsing process ?

Re: Non breakable space : how to ?

The only difficulties I see are BBcode (especially code) and maybe smiles..

.._ -Pandark- _..
Serial Dreamer

14

Re: Non breakable space : how to ?

It should be convenient to do such a substitution (before displaying the post content, or imho better before adding it in base):

Espace insécable devant ; : ! ?  (Non-breakable space before ...)

$content = eregi_replace("([ ]*)([?!:;]{1})", " \\2", $content);  http://www.phpinfo.net/regex/

15

Re: Non breakable space : how to ?

Do you know what file to be modified and in what way doing so ?
post.php ? about line 146 (where there is already the «    // Clean up message from POST» section), using $message variable instead of $content ?

16 (edited by Jérémie 2005-11-23 04:48)

Re: Non breakable space : how to ?

The easiest way would be to have an optionnal regexp that transform [space]:[space] into [nbsp]:[space] (and all the correct glyph. ?!:; etc. for french, as mentionned) when the post is saved/previewed if that string is not found in a <code> block.

Maybe a hook in that place (when a post is goind to be saved), and then 1.3 plugins will be able to do special i18n modifications ?

Edit: ok, I missed Gil's post. Well...
By the way, #160; are more supported than nbsp;. A detail, but still.

Second edit: ok I found how to manually insert a non-breaking space. Simply use & #160; (in one string of course), PunBB doesn't escape it like   .