Solved

Removing letters from microsoft office from textarea before submitting

Posted on 2006-06-26
2
163 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
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.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

756 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