Solved

Removing letters from microsoft office from textarea before submitting

Posted on 2006-06-26
2
161 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Matthew
I am a very big proponent of technology compliance standards and strive to meet such criteria in all of my work. That includes my site, which is 100% XHTML 1.0 compliant as determined by the World Wide Web Consortium. https://www.matthewstevenkel…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

776 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