Re:Re: [PHP] About Guest Book\\\'s messages....
| From: | fongming | Date: | Wed, 28 May 2003 20:14:08 +0000 |
| Subject: | Re:Re: [PHP] About Guest Book\\\'s messages.... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-149231@lists.php.net to get a copy of this message | ||
Hi, sir:
I tried it but also failed.
For One Chinese Character is composed with two bytes,
and between every word and word in a line,
there is no space " ",(Not like english).
For example:
English's thank you is : Thank you very much!
Chinese's thank you is : ¯uªº¦hÁ±z¤F¡I
and some word's second byte is "\" char,
and it would be combine with "\n" to be "\\n",
and it's structure would be destroied .
Any idea ? Thanks .........
-----------------original mail--------------------
Greetings,
How about some simple word detection attempts like:
$words = explode (' ',$input); //create array
$new_words = ''; //empty
foreach ($words as $word)
{
if (strlen ($word) <= 40)) { $word = wordwrap ($word,40,"\n",1); }
$new_words .= ' '.$word; //add word(s) to string
}
$new_words = trim ($new_words); //kill excess spaces
So the idea here is to check each supposed word for it's length, if its a long word,
longer than 40 characters, break it up. This should leave the smaller and hopefully real
words away from the wordwrap-ing.
note that this is completely untested, I just wrote it here in email.
Hope that helps.
--
Jason k Larson
fongming wrote:
> Hi, Sir:
>
> There may be someone leave a message like
> following:
>
>
> UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
>
> and it expand the width of the table on my web page and make pages ugly....
>
> I used wordwrap($word,40,"\n",1) to prevent it,
> but my system is BIG5 ,two bytes,
> Sometimes this method would destroy the structure
> of the two-bytes word.
>
> Any one has good ideas and could help me with that ?
> Thanks........
>
>
> -----------------------------------
> Fongming from Taiwan.
>
>
> ------------------------------------------
> ¡»From: ¦¹«H¬O¥Ñ®ç¤p¹q¤l¶l¥ó1.5ª©©Òµo¥X...
> http://fonn.fongming.idv.tw
> fongming@fonn.fongming.idv.tw
>
------------------------------------------
¡»From: ¦¹«H¬O¥Ñ®ç¤p¹q¤l¶l¥ó1.5ª©©Òµo¥X...
http://fonn.fongming.idv.tw
fongming@fonn.fongming.idv.tw