note 13373 added to ref.strings.php

From: Date: Wed, 13 Jun 2001 17:31:48 +0000
Subject: note 13373 added to ref.strings.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-14371@lists.php.net to get a copy of this message
Browsers (Internet Explorer at least) won't wrap text immediately before puntuation . ? ! ( ) [ ] { } / even if the preceeding character is whitespace. I believe this is intentional widow/orphan prevention behavior. This complicates the processing of user-inputed text (e.g. the message board junk problem). Even if you use <textarea wrap=hard> to force newlines into the input text (which is imperfect since a clever user can just modify the HTML before posting), people posting long strings of punctuation characters, or just punctuation characters at the beginning of each line in the <textarea> will mess up the format of the page for users viewing their post. You obviously can't solve this by just inserting a spaces - the browser still won't wrap. My solution is to use str_replace to put a &nbsp; (the least visually impacting non-whitespace character I can think of) between the \n and any pucntuation so the wrap can happen in the whitespace before the &nbsp;. Kindof ironic to be using &nbsp; to *cause* a break:) http://www.php.net/manual/en/ref.strings.php

« previous php.notes (#14371) next »