DataPrep = Replace(strText, ";", "")
DataPrep = Replace(DataPrep, "'", "'")
DataPrep = Replace(DataPrep, """", """)
DataPrep = Replace(DataPrep, "<", "<")
DataPrep = Replace(DataPrep, ">", ">")
End if
End Function
"S N" <uand...@yahoo.com> wrote in message news:OCmJVc5h...@TK2MSFTNGP05.phx.gbl...
Response.Write Server.HTMLEncode(strText)
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
> "Dataprep" type function allows for customization, otherwise nothing
> wrong with your suggested solution...
whose?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
please advise
"Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot com> wrote in message
news:13tqv4u...@corp.supernews.com...
If you just want to print the literal characters, that's easy enough:
Response.Write """"
will print a single " (there are 4 " in that line, the two outer ones are
the string containers, the two inners generate the single " as doubling them
up inside a string turns them into a literal instead).
another example
Response.Write "<a href=""http://myurl.com/apage.asp"">This is a link</a>"
Notice how you just double up the quotation marks.
For an apostrophe you don't need to do anything special:
Response.Write "They're not here"
So what problem are you having with quotes and apostrophes?
Dan
From the original post: "my code using response.write replaces " character
with question
mark"
It's most likely a codepage problem. I've been holding back from replying to
this because Anthony typically has the most reliable advice for these
situations.
> Daniel Crichton wrote:
>> ' and " are HTML entities - these are converted by web
>> browsers into ' and " respectively.
>> If you just want to print the literal characters, that's easy enough:
>> Response.Write """"
>> will print a single " (there are 4 " in that line, the two outer ones
>> are the string containers, the two inners generate the single " as
>> doubling them up inside a string turns them into a literal instead).
>> another example
>> Response.Write "<a href=""http://myurl.com/apage.asp"">This is a
>> link</a>"
>> Notice how you just double up the quotation marks.
>> For an apostrophe you don't need to do anything special:
>> Response.Write "They're not here"
>> So what problem are you having with quotes and apostrophes?
> From the original post: "my code using response.write replaces "
> character with question mark"
I missed that, I'd been reading the other replies.
> It's most likely a codepage problem. I've been holding back from
> replying to this because Anthony typically has the most reliable
> advice for these situations.
Then again it could be anything without the OP supplying example code that
has the problem, as it might be down to the way he's trying to print those
characters (for instance, using CHR(X) and providing the wrong X value).
--
Dan
Thanks for the vote of confidence Bob but it baffles me. ;)
Since " is within the lower ascii range 0-127 the only encoding that could
screw this up would be UTF-16. But if the browser thought it was getting
say Windows-1252 and yet the server was encoding to UTF-16 (or vice versa)
the content would be completely garbled.
I suspect that what the OP thinks is happening and what actually is are very
different. Like Dan says I think we would need to see some actual code to
make sense of this.
--
Anthony Jones - MVP ASP/ASP.NET
"S N" <uand...@yahoo.com> wrote in message news:OgWpL$piIHA...@TK2MSFTNGP03.phx.gbl...
"Anthony Jones" <A...@yadayadayada.com> wrote in message news:ejiWc1ti...@TK2MSFTNGP06.phx.gbl...
"S N" <uand...@yahoo.com> wrote in message news:%23m$1focjI...@TK2MSFTNGP04.phx.gbl...
"S N" <uand...@yahoo.com> wrote in message news:uPZpO2cj...@TK2MSFTNGP04.phx.gbl...
I suspect you will need to look elsewhere in your database/server/browser to find the problem.
I suggest you start debugging by allowing the page to be viewed by someone else with another browser so you can start eliminating
variables.
Narrow down the problem to where it can be isolated and then you may be able to resolve this matter.
"Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot com> wrote in message
news:13ufof3...@corp.supernews.com...
microsoft.public.scripting.vbscript
please help.
"Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot com> wrote in message
news:13ufshh...@corp.supernews.com...
"S N" <uand...@yahoo.com> wrote in message news:O3b5Voc...@TK2MSFTNGP04.phx.gbl...
"S N" <uand...@yahoo.com> wrote in message news:%23m$1focjI...@TK2MSFTNGP04.phx.gbl...
This as good a group as any to get help with this issue.
My current guess is that the data has been entered by a Form post via ASP.
In correct codepage settings have corrupted the data entered into the DB.
"S N" <uand...@yahoo.com> wrote in message news:%23m$1focjI...@TK2MSFTNGP04.phx.gbl...
Dan
"Paul Randall" <paul...@cableone.net> wrote in message news:OOTWT7fj...@TK2MSFTNGP06.phx.gbl...
If access is showing the wrong character that indicates the data is corrupt.
If the field contains HTML (which it appears it does if it has <br> and <p>
elements that you expect to be honors) then you should not be using
Server.HTMLEncode. It has to be assumed that a field containing HTML is
already HTML encoded.
This is a long thread, I can't remember if you indicated how the data
arrived in the DB in the first place.
also please tell me how to ensure that regardless of whether the data is
html encoded or not, my server.htmlencode should work alright.
"Anthony Jones" <A...@yadayadayada.com> wrote in message
news:expbSYCm...@TK2MSFTNGP05.phx.gbl...
I haven't read the whole thread, but pasting directly from Word into a rich
text box is asking for trouble. I recommend pasting from Word into Notepad,
then taking the result and pasting it into the Rich text box. Word
sometimes does odd things with what should be "double quotes". And it
retains a whole load of Word-specific formatting - often over-riding your
carefully crafted css.
--
Mike Brind
Microsoft MVP - ASP/ASP.NET
"Mike Brind [MVP]" <paxt...@hotmail.com> wrote in message
news:OtkF6xHm...@TK2MSFTNGP06.phx.gbl...
I would suggest using a client side script to ensure the data pasted
from Word is going in correctly. Word is notorious for really bad,
bloated markup. Google for WYSIWYG textarea - I like the one from The
Man in Blue at [http://www.themaninblue.com/experiment/widgEditor/].
--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
As Anthony said, if you are entering html code into the database with the
idea that this takes effect when you pull it back to a web page, you do not
want to server.htmlencode it. Since you are using a Rich Text Editor, I am
assuming that this will apply html tags to the text on entry, and you want
them to act on the output.
What you really want to do is to make sure no javascript or clientside
vbscript gets injected. One way to do this is just to reject any input that
contains the string "<script>" in it during your server-side validation.
>> As Anthony said, if you are entering html code into the database with the
>> idea that this takes effect when you pull it back to a web page, you do
>> not
>> want to server.htmlencode it. Since you are using a Rich Text Editor, I
>> am
>> assuming that this will apply html tags to the text on entry, and you
>> want
>> them to act on the output.
>>
>> What you really want to do is to make sure no javascript or clientside
>> vbscript gets injected. One way to do this is just to reject any input
>> that
>> contains the string "<script>" in it during your server-side validation.
>>
>> --
>> Mike Brind
>> Microsoft MVP - ASP/ASP.NET
>>
>
>
> you have guessed it very correctly that i am entering html code into the
> database (like table tags <td> > <tr> in particular) with the
> idea that this takes effect when it is pulled back to a web page, and
> hence i dont want to > server.htmlencode it.
>
> can you suggest a server side validation script which does as indicated
> below by you. else can you > suggest an alternate method of achieving
> the above (ensuring the table tags get translated into tables > on the
> client side).
'input is the posted content from the Rich Text Editor
If InStr(input, "<string>") > 0 Then
'reject it
Else
'process it
End If