467,144 Members | 1,138 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,144 developers. It's quick & easy.

Linebreak problems when copy&paste from word

Hi,

I have a form, where the user enters text. After submit, the text is
then inserted into a PostgreSQL database. So far, so good.

The problem is, that most of my users copy&paste their text from MS Word
into the textbox. Now I have these (hidden) linebreaks in the string
that cause trouble when I furter process the text.

Is there a way (maybe just a simple PHP command) to get rid of these
formating things. I presume I would have to kind of "convert" the string
to unformatted text somehow.

Thanks for your input,
georg
Nov 23 '05 #1
  • viewed: 1261
Share:
2 Replies
Figure out what characters are causing the problem and use
str_replace():

<http://www.php.net/manual/en/function.str-replace.php>

You can then replace any characters you don't want with something else
(like an empty string). With the weird hidden characters, you may need
to use ord() and chr() to figure out what the ASCII values are.

Nov 23 '05 #2
ZeldorBlat wrote:
Figure out what characters are causing the problem and use
str_replace():

<http://www.php.net/manual/en/function.str-replace.php>

You can then replace any characters you don't want with something else
(like an empty string). With the weird hidden characters, you may need
to use ord() and chr() to figure out what the ASCII values are.


If you look at the first two 'User Contributed Notes' on this page:

http://at.php.net/manual/en/function.ord.php

Could one of those two help me with my problem (the linebreaks)? I only
see them removing quotes etc.

What is the linebreak code, I have ro replace?

thanks a lot,
georg

Nov 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Nelgonde | last post: by
1 post views Thread by Phil Stanton | last post: by
1 post views Thread by perryche@yahoo.com | last post: by
reply views Thread by James | last post: by
6 posts views Thread by NuB | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.