XHTML Compliance - Microsoft word apostrophe

Hi I have a news page updated by a control panel which users just often copy and paste news items from a Microsoft Word document.  I want the output page to be html compliant and have a replace function on the page for the & symbol and a few others.  I cannot find one for the curly apostrophe that comes from the Word Document.

server.htmlencode will not work as i want to be able to include html links in the item.

Thanks
LVL 3
harris9999Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kevp75Commented:
I use the function below to get all HTML tags out of a textarea (or any other form field actually)

<%
Function rmvHTML(strString)
     Dim nCharPos, sOut, bInTag, sChar
     sOut = ""
     bInTag = False
     For nCharPos = 1 To Len(strString)
          sChar = Mid(strString, nCharPos, 1)
          if sChar = "<" Then
               bInTag = True
          end if
          if not bInTag Then sOut = sOut & sChar
          if sChar = ">" then
               bInTag = False
          End if
     Next
     rmvHTML = sOut
End Function
%>

you could also do something similar to this:
<script language="JavaScript">
<!--
function Del(Word) {
a = Word.indexOf("<");
b = Word.indexOf(">");
len = Word.length;
c = Word.substring(0, a);
if(b == -1)
b = a;
d = Word.substring((b + 1), len);
Word = c + d;
tagCheck = Word.indexOf("<");
if(tagCheck != -1)
Word = Del(Word);
return Word;
}
function Check() {
ToCheck = document.form.text.value;
Checked = Del(ToCheck);
document.form.text.value = Checked;
alert("This form is not set to submit anywhere so you will stay here.  But please notice that the text box's contents have been \"filtered\".");
return false;
}
// -->
</script>
</head>
<body>
<center><h1>Removing HTML</h1></center>
<p>This script is intended to ensure that people do not use HTML tags in form messages, Web forums, and so on. Type some text with HTML tags in the box below to try it out.</p>
<form name=form onSubmit="return Check()">
<textarea cols="50" rows="6" name="text"></textarea>
<br>
<input type="submit" value="Submit Entry">
</form>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
harris9999Author Commented:
Hi,

I want to be able to include the html tag in the text area, so that a link could be added if required.  Thats why i can't use, server.htmlencode.  
I just noticed a typo in my initial message.  i want the output to be xhtml compliant.  
In the page where it is output i replace the & symbol etc

                  strText = replace(rs.fields("Details"),"&#8217;","'")
                  strText = replace(strText,"&","&amp;")
                  strText = replace(strText,"&#8217;","'")
                  strText = replace(strText,"&rsquo;","'")
                  strText = replace(strText,"‘","'")
                  strText = replace(strText,"&rsquo;","'")

i have tried to replace the various aprostophe's but i can't get one to replace the apostrophe which is pasted from a word document, and it is this one which breaks the xhtml compliance.
0
harris9999Author Commented:
strText = replace(strText, Chr(146),"'")

This fixed the problem
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.