Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Removing letters from microsoft office from textarea before submitting

Posted on 2006-06-26
2
Medium Priority
?
166 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 750 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

Industry Leaders: 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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
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 learn the basics of jQuery including how to code hide show and toggles. 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…

715 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