Server.HTMLEncode and pasting from Word

Results 1 to 2 of 2

Thread: Server.HTMLEncode and pasting from Word

  1. #1
    Join Date
    Dec 1969

    Default Server.HTMLEncode and pasting from Word

    I have a form, I have been pasting in info from Word Docs into the form to add into an Access Db. <BR><BR>I run all the form content through this:<BR><BR>Function newstr(str)<BR> newstr = (Replace(str, "&#039;","&#039;&#039;"))<BR>End Function<BR><BR>info = Server.HTMLEncode(newstr(request("info")))<BR><BR> So if I paste in something like this: <BR><BR>‘Be a Host PC’<BR><BR>from Word I get this when I get the output after reading it from the Db after it has been inserted into the db:<BR><BR>& # 8 2 1 6 ; Be a Host PC & # 8 2 1 7 ;<BR><BR>I&#039;ve put spaces in there to prevent the forum coverting it to apostrophes.<BR><BR>Is it just that Word uses a whole load of different characters which, short of passing each string through a separate replace function for all of the different characters, <BR><BR>e.g.<BR><BR>Function ap(str)<BR> ap = (Replace(str, " & # 8 2 1 6 ;","&#039;"))<BR>End Function<BR><BR>is just something I&#039;ll have to put up with? Or just not copy from Word? OR just not user Server.HTMLEncode? I was using Server.HTMLEncode to stop people putting in &#060;%....%&#062; asp code which would mess things up for me. <BR><BR>Thanks <BR><BR>Jim

  2. #2
    Join Date
    Dec 1969

    Default Well...

    Why not search for &#060;script&#062;...&#060;/script&#062; and &#060;%...%&#062; tags and just remove stuff between them? Simple string manipulation.<BR><BR>Sounds to me like Server.HTMLEncode isn&#039;t what you are after. Especially if you&#039;re going to want to take this from the DB and display it at some point in the future...<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts