Linebreak problems when copy&paste from word

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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,

Re: Linebreak problems when copy&paste from word

Figure out what characters are causing the problem and use


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.

Re: Linebreak problems when copy&paste from word

ZeldorBlat wrote:
Quoted text here. Click to load it

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

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,

Site Timeline