Solved

Removing letters from microsoft office from textarea before submitting

Posted on 2006-06-26
2
159 Views
Last Modified: 2010-04-06
I have created a "wiki" based CMS system, where the users can submit the content using forms. This works OK, but sometimes the users copy-paste from word causing an error in the system due to encoding problems on the server. The submitted content is written to XML files.

I see the following options:
 - Replace all illegal letters using javascript before submitting the form
 - Displaying a warning if the user submitted an illegal letter

The solution can be created using javascript or serverbased using J2EE technology.

How do I detect these illegal letters?
How do I replace / remove these?

Regards

Morten
0
Comment
Question by:mortena
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 250 total points
ID: 16983322
Hi mortena,

It is a fairly common issue, you can use URLEncoding to deal with this. As you suggest replacing the characters in the textarea with permissable ones.

var ta=document.getElementById('MyTextArea')
ta.value = escape(ta.value)

In your OnSubmit() event. This will encode the string, which you can decode at the server using Server.URLDecode and store in your XML file. Or even store it undecoded and only decode when you need to send this back to a client. There is no harm in doing this for all your content whether or not it contains any illegal character. Except for a possible slight performance hit, though how big that might be is impossible to state with any accuracy at this point.

Tim Cottee
0
 

Author Comment

by:mortena
ID: 16999819
Well I found a solution, where I escape the content of whatever is in my forms on the page, replaces the escaped symbols with whatever is similar and legal and put's it right back into the input field in the form. See (and use if you need it):

http://www.blobcom.com/encodingControl.js

This can be included by inserting the following into the html:

 <script type="text/javascript" src="http://www.videntilvaekst.dk/extWiki/encodingControl.js"></script>

and for the form you need to "legalize" you have to put a:

onsubmit="legalizeForm()" attribute.

All I need now is a list of letters to translate and what they should be translated to. Please point me towards such a list.

Regards

Morten Andersen
Blob Communication

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now