Copy and paste unreadable characters

T

tom.henricksen

We have a web page where application users are coping and pasting some
text from WordPerfect or MS Word. We have noticed some of the
characters are unreadable. These characters have special formating on
them from the word processing application. For instance one has the
Trademark symbol which is a small tm but contains some special
formating. When this is pasted it doesn't render correctly as the
browser doesn't understand the character. We are using IE 6.0.2.
Also they have double quotes that when pasted are very different then
if I typed them in. I am looking for some javascript code that could
replace this or stip it out. Does anyone know of a regular expression
that might do this? Or maybe an alternative idea?

Thanks in Advance,
Tom
 
T

tom.henricksen

Jim said:
(e-mail address removed) wrote in @m73g2000cwd.googlegroups.com:


Server-side code to filter the bad characters out of the input text and
replace them with HTML-friendly characters. Your server does have
scripting languages, doesn't it, like php, asp, or cfm?

We are using JSON with Java on the server. Normally I would try to do
this on the server as my Java skills are stronger than my JavaScript
skills. The problem is I need to clean out these characters before we
hand it off to JSON or else the data doesn't get to the server.

I tried doing things like

description = description.replace( /\\ /g,"");

But that didn't work.
Thanks,
Tom
 
T

tom.henricksen

I finally found this code to remove unreadable characters. It leaves
the special character needed.

replace( /[^\w\.(){}\];?!@#$\^%&*-\\:~`\"-]/g," ")

Thanks,
Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top