how to print apostrophe character ' and double quote " in asp using
vbscript.
my code using response.write replaces " character with inverted question
mark.
please help

Re: printing character ' and " in asp using vbscript by S

S
Sun Mar 16 13:57:35 CDT 2008

how to print apostrophe character ' and double quote " in asp using
vbscript. my code using response.write replaces " character with question
mark.
please help



Re: printing character ' and " in asp using vbscript by Jon

Jon
Sun Mar 16 15:01:32 CDT 2008

'******************************************************************
Function DataPrep(strText)
'
'PURPOSE: prep data text entry
'
'PARAMETERS: strText -- text string to modify
'******************************************************************
If NOT isNull(strText) then

DataPrep = Replace(strText, ";", "")
DataPrep = Replace(DataPrep, "'", "'")
DataPrep = Replace(DataPrep, """", """)
DataPrep = Replace(DataPrep, "<", "&lt;")
DataPrep = Replace(DataPrep, ">", "&gt;")

End if

End Function




"S N" <uandme72@yahoo.com> wrote in message news:OCmJVc5hIHA.4076@TK2MSFTNGP05.phx.gbl...
> how to print apostrophe character ' and double quote " in asp using vbscript.
> my code using response.write replaces " character with inverted question mark.
> please help
>
>



Re: printing character ' and " in asp using vbscript by Bob

Bob
Sun Mar 16 17:30:06 CDT 2008

Jon Paal [MSMD] wrote:
> '******************************************************************
> Function DataPrep(strText)
> '
> 'PURPOSE: prep data text entry
> '
> 'PARAMETERS: strText -- text string to modify
> '******************************************************************
> If NOT isNull(strText) then
>
> DataPrep = Replace(strText, ";", "")
> DataPrep = Replace(DataPrep, "'", "&apos;")
> DataPrep = Replace(DataPrep, """", "&quot;")
> DataPrep = Replace(DataPrep, "<", "&lt;")
> DataPrep = Replace(DataPrep, ">", "&gt;")
>
> End if
>
> End Function
>
??
What's wrong with

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"



Re: printing character ' and " in asp using vbscript by Jon

Jon
Sun Mar 16 22:45:00 CDT 2008

"Dataprep" type function allows for customization, otherwise nothing wrong with your suggested solution...



Re: printing character ' and " in asp using vbscript by Evertjan

Evertjan
Mon Mar 17 03:51:24 CDT 2008

Jon Paal [MSMD] wrote on 17 mrt 2008 in
microsoft.public.inetserver.asp.general:

> "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)

Re: printing character ' and " in asp using vbscript by msnews

msnews
Mon Mar 17 04:35:23 CDT 2008

where to get the values of constants like &apos and &quot
also i want to replace single " and not double ""

please advise

"Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot com> wrote in message
news:13tqv4u4qegn7c8@corp.supernews.com...
> '******************************************************************
> Function DataPrep(strText)
> '
> 'PURPOSE: prep data text entry
> '
> 'PARAMETERS: strText -- text string to modify
> '******************************************************************
> If NOT isNull(strText) then
>
> DataPrep = Replace(strText, ";", "")
> DataPrep = Replace(DataPrep, "'", "&apos;")
> DataPrep = Replace(DataPrep, """", "&quot;")
> DataPrep = Replace(DataPrep, "<", "&lt;")
> DataPrep = Replace(DataPrep, ">", "&gt;")
>
> End if
>
> End Function
>
>
>
>
> "S N" <uandme72@yahoo.com> wrote in message
> news:OCmJVc5hIHA.4076@TK2MSFTNGP05.phx.gbl...
>> how to print apostrophe character ' and double quote " in asp using
>> vbscript.
>> my code using response.write replaces " character with inverted question
>> mark.
>> please help
>>
>>
>
>



Re: printing character ' and " in asp using vbscript by Daniel

Daniel
Mon Mar 17 05:06:39 CDT 2008

&apos; and &quot; 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?


Dan

msnews wrote on Mon, 17 Mar 2008 15:05:23 +0530:

> where to get the values of constants like &apos and &quot also i want
> to replace single " and not double ""

> please advise

> "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot com> wrote in
> message news:13tqv4u4qegn7c8@corp.supernews.com...
>> '******************************************************************
>> Function DataPrep(strText)
>> '
>> 'PURPOSE: prep data text entry '
>> 'PARAMETERS: strText -- text string to modify
>> '******************************************************************
>> If NOT isNull(strText) then

>> DataPrep = Replace(strText, ";", "")
>> DataPrep = Replace(DataPrep, "'", "&apos;")
>> DataPrep = Replace(DataPrep, """", "&quot;")
>> DataPrep = Replace(DataPrep, "<", "&lt;")
>> DataPrep = Replace(DataPrep, ">", "&gt;")

>> End if

>> End Function




>> "S N" <uandme72@yahoo.com> wrote in message
>> news:OCmJVc5hIHA.4076@TK2MSFTNGP05.phx.gbl...
>>> how to print apostrophe character ' and double quote " in asp using
>>> vbscript.
>>> my code using response.write replaces " character with inverted
>>> question mark.
>>> please help







Re: printing character ' and " in asp using vbscript by Bob

Bob
Mon Mar 17 05:43:16 CDT 2008

Daniel Crichton wrote:
> &apos; and &quot; 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"

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.



--
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"



Re: printing character ' and " in asp using vbscript by Daniel

Daniel
Mon Mar 17 10:10:28 CDT 2008

Bob wrote on Mon, 17 Mar 2008 06:43:16 -0400:

> Daniel Crichton wrote:
>> &apos; and &quot; 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



Re: printing character ' and " in asp using vbscript by Anthony

Anthony
Tue Mar 18 11:04:11 CDT 2008

"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl...
> Daniel Crichton wrote:
> > &apos; and &quot; 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"
>
> 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.
>

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



Re: printing character ' and " in asp using vbscript by S

S
Thu Mar 20 10:33:48 CDT 2008

This is a multi-part message in MIME format.

------=_NextPart_000_0027_01C88ACD.E5B321F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

i am attaching the sample code. actually i am printing from a field in =
access database. the text entered in the database contains single quotes =
and double quotes. when i try to print them using response.write, the =
double quotes are getting replaced with question marks. i have tried the =
method of=20

DataPrep =3D Replace(DataPrep, """", "&quot;")

still problem remains.

i also tried
response.write(server.htmlencode(myrs(3))) ' where myrs is adodb =
recordset

still the problem remains

i am also attaching the header lines from my asp page

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@LANGUAGE=3D"VBSCRIPT" CODEPAGE=3D"1252"%>


<HTML><HEAD>
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1" />
<meta http-equiv=3D"Content-Language" content=3D"en-us" />

the problem is still not solved

please help



"Anthony Jones" <Ant@yadayadayada.com> wrote in message =
news:%23jGo1GRiIHA.5088@TK2MSFTNGP02.phx.gbl...
> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl...
>> Daniel Crichton wrote:
>> > &apos; and &quot; 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=3D""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"
>>
>> 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.
>>
>=20
> Thanks for the vote of confidence Bob but it baffles me. ;)
>=20
> 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.
>=20
> 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.
>=20
> --=20
> Anthony Jones - MVP ASP/ASP.NET
>=20
>
------=_NextPart_000_0027_01C88ACD.E5B321F0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.3157" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>i am attaching the sample code. =
actually i am=20
printing from a field in access database. the text entered in the =
database=20
contains single quotes and double quotes. when i try to print them using =

response.write, the double quotes are getting replaced with question =
marks. i=20
have tried the method of </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>DataPrep =3D Replace(DataPrep, =
"""",=20
"&amp;quot;")</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>still problem remains.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>i also tried</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2><STRONG>response.write(server.htmlencode(myrs(3)))&nbsp;&nbsp; =
' where=20
myrs is adodb recordset</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>still the problem remains</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>i am also attaching the header lines =
from my asp=20
page</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>&lt;!DOCTYPE HTML PUBLIC =
"-//W3C//DTD HTML=20
4.01 Transitional//EN"&gt;<BR>&lt;</STRONG></FONT><A=20
href=3D'mailto:%@LANGUAGE=3D"VBSCRIPT'><FONT face=3DArial=20
size=3D2><STRONG>%@LANGUAGE=3D"VBSCRIPT</STRONG></FONT></A><FONT =
face=3DArial=20
size=3D2><STRONG>" CODEPAGE=3D"1252"%&gt;<BR></STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG></STRONG></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2><STRONG>&lt;HTML&gt;&lt;HEAD&gt;<BR>&lt;meta=20
http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-1"=20
/&gt;<BR>&lt;meta http-equiv=3D"Content-Language" content=3D"en-us"=20
/&gt;</STRONG><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>the problem is still not =
solved</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>please help</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Anthony Jones" &lt;</FONT><A=20
href=3D"mailto:Ant@yadayadayada.com"><FONT face=3DArial=20
size=3D2>Ant@yadayadayada.com</FONT></A><FONT face=3DArial size=3D2>&gt; =
wrote in=20
message </FONT><A =
href=3D"news:%23jGo1GRiIHA.5088@TK2MSFTNGP02.phx.gbl"><FONT=20
face=3DArial =
size=3D2>news:%23jGo1GRiIHA.5088@TK2MSFTNGP02.phx.gbl</FONT></A><FONT=20
face=3DArial size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt; =
"Bob Barrows=20
[MVP]" &lt;</FONT><A href=3D"mailto:reb01501@NOyahoo.SPAMcom"><FONT =
face=3DArial=20
size=3D2>reb01501@NOyahoo.SPAMcom</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote in=20
message<BR>&gt; </FONT><A=20
href=3D"news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl"><FONT face=3DArial =

size=3D2>news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>&gt;&gt; Daniel Crichton wrote:<BR>&gt;&gt; &gt; =
&amp;apos; and=20
&amp;quot; are HTML entities - these are converted by web<BR>&gt;&gt; =
&gt;=20
browsers into ' and " respectively.<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; If =
you=20
just want to print the literal characters, that's easy =
enough:<BR>&gt;&gt;=20
&gt;<BR>&gt;&gt; &gt; Response.Write """"<BR>&gt;&gt; &gt;<BR>&gt;&gt; =
&gt; will=20
print a single " (there are 4 " in that line, the two outer =
ones<BR>&gt;&gt;=20
&gt; are the string containers, the two inners generate the single "=20
as<BR>&gt;&gt; &gt; doubling them up inside a string turns them into a =
literal=20
instead).<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; another example<BR>&gt;&gt;=20
&gt;<BR>&gt;&gt; &gt; Response.Write "&lt;a href=3D""</FONT><A=20
href=3D'http://myurl.com/apage.asp"">This'><FONT face=3DArial=20
size=3D2>http://myurl.com/apage.asp""&gt;This</FONT></A><FONT =
face=3DArial size=3D2>=20
is a<BR>&gt;&gt; &gt; link&lt;/a&gt;"<BR>&gt;&gt; &gt; Notice how you =
just=20
double up the quotation marks.<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; For an=20
apostrophe you don't need to do anything special:<BR>&gt;&gt; =
&gt;<BR>&gt;&gt;=20
&gt; Response.Write "They're not here"<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; =
So what=20
problem are you having with quotes and apostrophes?<BR>&gt;&gt;=20
&gt;<BR>&gt;&gt;<BR>&gt;&gt; From the original post: "my code using=20
response.write replaces " character<BR>&gt;&gt; with =
question<BR>&gt;&gt;=20
mark"<BR>&gt;&gt;<BR>&gt;&gt; It's most likely a codepage problem. I've =
been=20
holding back from replying<BR>&gt; to<BR>&gt;&gt; this because Anthony =
typically=20
has the most reliable advice for these<BR>&gt;&gt;=20
situations.<BR>&gt;&gt;<BR>&gt; <BR>&gt; Thanks for the vote of =
confidence Bob=20
but it baffles me.&nbsp; ;)<BR>&gt; <BR>&gt; Since " is within the lower =
ascii=20
range 0-127 the only encoding that could<BR>&gt; screw this up would be=20
UTF-16.&nbsp; But if the browser thought it was getting<BR>&gt; say =
Windows-1252=20
and yet the server was encoding to UTF-16 (or vice versa)<BR>&gt; the =
content=20
would be completely garbled.<BR>&gt; <BR>&gt; I suspect that what the OP =
thinks=20
is happening and what actually is are very<BR>&gt; different.&nbsp; Like =
Dan=20
says I think we would need to see some actual code to<BR>&gt; make sense =
of=20
this.<BR>&gt; <BR>&gt; -- <BR>&gt; Anthony Jones - MVP =
ASP/ASP.NET<BR>&gt;=20
<BR>&gt;</FONT></BODY></HTML>

------=_NextPart_000_0027_01C88ACD.E5B321F0--


Re: printing character ' and " in asp using vbscript by Paul

Paul
Thu Mar 20 15:48:31 CDT 2008

This is a multi-part message in MIME format.

------=_NextPart_000_0016_01C88A99.77B2B910
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Within VBScript strings, all characters are stored as 16-bit Unicode =
values, so you can't easily tell whether your string contains Unicode or =
not. Depending on how well the data was scrubbed before being put in =
the database, it may contain some Unicode. Depending on how your =
computer is set up, it is not obvious when you display Unicode =
characters in a message box. VBScript includes a number of functions =
for interacting with Unicode characters -- the W versions of things like =
ChrW and AscW.

Here is a short script that demonstrates a message box displaying a =
string that includes a Unicode character (that looks something like a =
single quote) and the same string with that character removed (using a =
simple regular expression).

Dim s
s =3D "Hello *" & ChrW(900) & "* unicode"
msgbox s & vbcrlf & sRemoveUnicode(s)

Function sRemoveUnicode(sAnyString)
'Returns sAnyString with all unicode [actually, all
' characters outside the range ChrW(0) to
' ChrW(255)] removed. VBScript strings are made
' up of 16-bit characters so they can handle a
' lot of unicode stuff.

With New RegExp
.Pattern =3D "[^\u0000-\u007F]"
sRemoveUnicode =3D .Replace(sAnyString, "")
End With

End Function

-Paul Randall

"S N" <uandme72@yahoo.com> wrote in message =
news:OgWpL$piIHA.4344@TK2MSFTNGP03.phx.gbl...
i am attaching the sample code. actually i am printing from a field in =
access database. the text entered in the database contains single quotes =
and double quotes. when i try to print them using response.write, the =
double quotes are getting replaced with question marks. i have tried the =
method of=20

DataPrep =3D Replace(DataPrep, """", "&quot;")

still problem remains.

i also tried
response.write(server.htmlencode(myrs(3))) ' where myrs is adodb =
recordset

still the problem remains

i am also attaching the header lines from my asp page

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@LANGUAGE=3D"VBSCRIPT" CODEPAGE=3D"1252"%>


<HTML><HEAD>
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1" />
<meta http-equiv=3D"Content-Language" content=3D"en-us" />

the problem is still not solved

please help



"Anthony Jones" <Ant@yadayadayada.com> wrote in message =
news:%23jGo1GRiIHA.5088@TK2MSFTNGP02.phx.gbl...
> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl...
>> Daniel Crichton wrote:
>> > &apos; and &quot; 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=3D""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"
>>
>> 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.
>>
>=20
> Thanks for the vote of confidence Bob but it baffles me. ;)
>=20
> 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.
>=20
> 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.
>=20
> --=20
> Anthony Jones - MVP ASP/ASP.NET
>=20
>
------=_NextPart_000_0016_01C88A99.77B2B910
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2180" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Within VBScript strings, all characters =
are stored=20
as 16-bit Unicode values, so you can't easily tell whether your string =
contains=20
Unicode or not.&nbsp; Depending on how well the data was scrubbed before =
being=20
put in the database, it may contain some Unicode.&nbsp; Depending on how =
your=20
computer is set up, it is not obvious when you display Unicode =
characters in a=20
message box.&nbsp; VBScript includes a number of functions for =
interacting with=20
Unicode characters -- the W versions of things like ChrW and =
AscW.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Here is a short script that =
demonstrates a message=20
box displaying a string that includes a Unicode character (that looks =
something=20
like a single quote)&nbsp;and the same string with that character =
removed (using=20
a simple regular expression).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Dim s<BR>s =3D "Hello *" &amp; =
ChrW(900) &amp; "*=20
unicode"<BR>msgbox s &amp; vbcrlf &amp; sRemoveUnicode(s)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Function =
sRemoveUnicode(sAnyString)<BR>'Returns=20
sAnyString with all unicode [actually, all<BR>'&nbsp;characters outside =
the=20
range ChrW(0) to<BR>'&nbsp;ChrW(255)] removed.&nbsp; VBScript strings =
are=20
made<BR>'&nbsp;up of 16-bit characters so they can handle =
a<BR>'&nbsp;lot of=20
unicode stuff.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>With New RegExp<BR>&nbsp;.Pattern =3D=20
"[^\u0000-\u007F]"<BR>&nbsp;sRemoveUnicode =3D .Replace(sAnyString, =
"")<BR>End=20
With<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>End Function</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</DIV></FONT>
<DIV><FONT face=3DArial size=3D2>-Paul Randall</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>"S N" &lt;<A =
href=3D"mailto:uandme72@yahoo.com">uandme72@yahoo.com</A>&gt;=20
wrote in message <A=20
href=3D"news:OgWpL$piIHA.4344@TK2MSFTNGP03.phx.gbl">news:OgWpL$piIHA.4344=
@TK2MSFTNGP03.phx.gbl</A>...</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial size=3D2>i am attaching the sample code. =
actually i am=20
printing from a field in access database. the text entered in the =
database=20
contains single quotes and double quotes. when i try to print them =
using=20
response.write, the double quotes are getting replaced with question =
marks. i=20
have tried the method of </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>DataPrep =3D =
Replace(DataPrep, """",=20
"&amp;quot;")</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>still problem remains.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>i also tried</FONT></DIV>
<DIV><FONT face=3DArial=20
=
size=3D2><STRONG>response.write(server.htmlencode(myrs(3)))&nbsp;&nbsp; =
' where=20
myrs is adodb recordset</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>still the problem =
remains</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>i am also attaching the header lines =
from my asp=20
page</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>&lt;!DOCTYPE HTML PUBLIC =
"-//W3C//DTD=20
HTML 4.01 Transitional//EN"&gt;<BR>&lt;</STRONG></FONT><A=20
href=3D'mailto:%@LANGUAGE=3D"VBSCRIPT'><FONT face=3DArial=20
size=3D2><STRONG>%@LANGUAGE=3D"VBSCRIPT</STRONG></FONT></A><FONT =
face=3DArial=20
size=3D2><STRONG>" CODEPAGE=3D"1252"%&gt;<BR></STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG></STRONG></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2><STRONG>&lt;HTML&gt;&lt;HEAD&gt;<BR>&lt;meta=20
http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1"=20
/&gt;<BR>&lt;meta http-equiv=3D"Content-Language" content=3D"en-us"=20
/&gt;</STRONG><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>the problem is still not =
solved</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>please help</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Anthony Jones" &lt;</FONT><A=20
href=3D"mailto:Ant@yadayadayada.com"><FONT face=3DArial=20
size=3D2>Ant@yadayadayada.com</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote in=20
message </FONT><A =
href=3D"news:%23jGo1GRiIHA.5088@TK2MSFTNGP02.phx.gbl"><FONT=20
face=3DArial =
size=3D2>news:%23jGo1GRiIHA.5088@TK2MSFTNGP02.phx.gbl</FONT></A><FONT=20
face=3DArial size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt; =
"Bob Barrows=20
[MVP]" &lt;</FONT><A href=3D"mailto:reb01501@NOyahoo.SPAMcom"><FONT =
face=3DArial=20
size=3D2>reb01501@NOyahoo.SPAMcom</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote=20
in message<BR>&gt; </FONT><A=20
href=3D"news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl"><FONT =
face=3DArial=20
size=3D2>news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>&gt;&gt; Daniel Crichton wrote:<BR>&gt;&gt; &gt; =
&amp;apos; and=20
&amp;quot; are HTML entities - these are converted by web<BR>&gt;&gt; =
&gt;=20
browsers into ' and " respectively.<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; =
If you=20
just want to print the literal characters, that's easy =
enough:<BR>&gt;&gt;=20
&gt;<BR>&gt;&gt; &gt; Response.Write """"<BR>&gt;&gt; &gt;<BR>&gt;&gt; =
&gt;=20
will print a single " (there are 4 " in that line, the two outer=20
ones<BR>&gt;&gt; &gt; are the string containers, the two inners =
generate the=20
single " as<BR>&gt;&gt; &gt; doubling them up inside a string turns =
them into=20
a literal instead).<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; another=20
example<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; Response.Write "&lt;a=20
href=3D""</FONT><A href=3D'http://myurl.com/apage.asp"">This'><FONT =
face=3DArial=20
size=3D2>http://myurl.com/apage.asp""&gt;This</FONT></A><FONT =
face=3DArial size=3D2>=20
is a<BR>&gt;&gt; &gt; link&lt;/a&gt;"<BR>&gt;&gt; &gt; Notice how you =
just=20
double up the quotation marks.<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; For =
an=20
apostrophe you don't need to do anything special:<BR>&gt;&gt; =
&gt;<BR>&gt;&gt;=20
&gt; Response.Write "They're not here"<BR>&gt;&gt; &gt;<BR>&gt;&gt; =
&gt; So=20
what problem are you having with quotes and apostrophes?<BR>&gt;&gt;=20
&gt;<BR>&gt;&gt;<BR>&gt;&gt; From the original post: "my code using=20
response.write replaces " character<BR>&gt;&gt; with =
question<BR>&gt;&gt;=20
mark"<BR>&gt;&gt;<BR>&gt;&gt; It's most likely a codepage problem. =
I've been=20
holding back from replying<BR>&gt; to<BR>&gt;&gt; this because Anthony =

typically has the most reliable advice for these<BR>&gt;&gt;=20
situations.<BR>&gt;&gt;<BR>&gt; <BR>&gt; Thanks for the vote of =
confidence Bob=20
but it baffles me.&nbsp; ;)<BR>&gt; <BR>&gt; Since " is within the =
lower ascii=20
range 0-127 the only encoding that could<BR>&gt; screw this up would =
be=20
UTF-16.&nbsp; But if the browser thought it was getting<BR>&gt; say=20
Windows-1252 and yet the server was encoding to UTF-16 (or vice =
versa)<BR>&gt;=20
the content would be completely garbled.<BR>&gt; <BR>&gt; I suspect =
that what=20
the OP thinks is happening and what actually is are very<BR>&gt;=20
different.&nbsp; Like Dan says I think we would need to see some =
actual code=20
to<BR>&gt; make sense of this.<BR>&gt; <BR>&gt; -- <BR>&gt; Anthony =
Jones -=20
MVP ASP/ASP.NET<BR>&gt; <BR>&gt;</FONT> </BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0016_01C88A99.77B2B910--


Re: printing character ' and " in asp using vbscript by Anthony

Anthony
Thu Mar 20 17:54:29 CDT 2008

This is a multi-part message in MIME format.

------=_NextPart_000_0129_01C88ADD.5AD9D550
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

My guess is that they are not " " but are ' " " typically cut'n'pasted =
in from Microsoft Word.

These are still in the Windows-1252 range of characters but are not =
strictly in the iso-8859-1 set.

Don't use http-equiv meta tags use real headers instead.

IOW ditch the meta tags and include this:-

<%Response.CharSet =3D "Windows-1252"%>

I'm not hopeful because you are probably using IE and IE will treat =
ISO-8859-1 as Windows-1252 anyway.

Always use Server.HtmlEncode on values retrieved from the Database. =
Stop mucking about with any other approach.

If that doesn't work view the html source from the browser. What is the =
server actually sending.

Another alternative is stop using Windows-1252.

Save your pages as UTF-8 change the codepage at the top of the page to =
65001 and include Response.CharSet =3D "UTF-8" in your page.

BTW, Have you looked at the field content directly using the DB =
management tool?


--=20
Anthony Jones - MVP ASP/ASP.NET
"S N" <uandme72@yahoo.com> wrote in message =
news:OgWpL$piIHA.4344@TK2MSFTNGP03.phx.gbl...
i am attaching the sample code. actually i am printing from a field in =
access database. the text entered in the database contains single quotes =
and double quotes. when i try to print them using response.write, the =
double quotes are getting replaced with question marks. i have tried the =
method of=20

DataPrep =3D Replace(DataPrep, """", "&quot;")

still problem remains.

i also tried
response.write(server.htmlencode(myrs(3))) ' where myrs is adodb =
recordset

still the problem remains

i am also attaching the header lines from my asp page

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@LANGUAGE=3D"VBSCRIPT" CODEPAGE=3D"1252"%>


<HTML><HEAD>
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1" />
<meta http-equiv=3D"Content-Language" content=3D"en-us" />

the problem is still not solved

please help



"Anthony Jones" <Ant@yadayadayada.com> wrote in message =
news:%23jGo1GRiIHA.5088@TK2MSFTNGP02.phx.gbl...
> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl...
>> Daniel Crichton wrote:
>> > &apos; and &quot; 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=3D""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"
>>
>> 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.
>>
>=20
> Thanks for the vote of confidence Bob but it baffles me. ;)
>=20
> 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.
>=20
> 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.
>=20
> --=20
> Anthony Jones - MVP ASP/ASP.NET
>=20
>
------=_NextPart_000_0129_01C88ADD.5AD9D550
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1607" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>My guess is that they are not " " but are <SPAN=20
style=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-GB; =
mso-fareast-language: EN-GB; mso-bidi-language: AR-SA">=91=20
=93 =94 typically cut'n'pasted in from Microsoft =
Word.</SPAN></FONT></DIV>
<DIV><FONT size=3D2></FONT><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>These are still in the Windows-1252 range of =
characters but=20
are not strictly in the iso-8859-1 set.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Don't use http-equiv meta tags use real headers=20
instead.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>IOW ditch the meta tags and include =
this:-</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>&lt;%Response.CharSet =3D =
"Windows-1252"%&gt;</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I'm not hopeful because you are probably using IE =
and IE will=20
treat ISO-8859-1 as Windows-1252 anyway.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Always use Server.HtmlEncode on values retrieved =
from the=20
Database.&nbsp; Stop mucking about with any other approach.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>If that doesn't work view the html source from the=20
browser.&nbsp; What is the server actually sending.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Another alternative is stop using =
Windows-1252.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Save your pages as UTF-8 change the codepage at the =
top of the=20
page to 65001 and include Response.CharSet =3D "UTF-8" in your =
page.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>BTW, Have you looked at the field content directly =
using the=20
DB management tool?</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT><FONT size=3D2></FONT><FONT =
size=3D2></FONT><FONT=20
size=3D2></FONT><FONT size=3D2></FONT><BR>-- <BR>Anthony Jones - MVP=20
ASP/ASP.NET</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"S N" &lt;<A =
href=3D"mailto:uandme72@yahoo.com">uandme72@yahoo.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:OgWpL$piIHA.4344@TK2MSFTNGP03.phx.gbl">news:OgWpL$piIHA.4344=
@TK2MSFTNGP03.phx.gbl</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>i am attaching the sample code. =
actually i am=20
printing from a field in access database. the text entered in the =
database=20
contains single quotes and double quotes. when i try to print them =
using=20
response.write, the double quotes are getting replaced with question =
marks. i=20
have tried the method of </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>DataPrep =3D =
Replace(DataPrep, """",=20
"&amp;quot;")</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>still problem remains.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>i also tried</FONT></DIV>
<DIV><FONT face=3DArial=20
=
size=3D2><STRONG>response.write(server.htmlencode(myrs(3)))&nbsp;&nbsp; =
' where=20
myrs is adodb recordset</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>still the problem =
remains</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>i am also attaching the header lines =
from my asp=20
page</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>&lt;!DOCTYPE HTML PUBLIC =
"-//W3C//DTD=20
HTML 4.01 Transitional//EN"&gt;<BR>&lt;</STRONG></FONT><A=20
href=3D'mailto:%@LANGUAGE=3D"VBSCRIPT'><FONT face=3DArial=20
size=3D2><STRONG>%@LANGUAGE=3D"VBSCRIPT</STRONG></FONT></A><FONT =
face=3DArial=20
size=3D2><STRONG>" CODEPAGE=3D"1252"%&gt;<BR></STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG></STRONG></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2><STRONG>&lt;HTML&gt;&lt;HEAD&gt;<BR>&lt;meta=20
http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1"=20
/&gt;<BR>&lt;meta http-equiv=3D"Content-Language" content=3D"en-us"=20
/&gt;</STRONG><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>the problem is still not =
solved</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>please help</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Anthony Jones" &lt;</FONT><A=20
href=3D"mailto:Ant@yadayadayada.com"><FONT face=3DArial=20
size=3D2>Ant@yadayadayada.com</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote in=20
message </FONT><A =
href=3D"news:%23jGo1GRiIHA.5088@TK2MSFTNGP02.phx.gbl"><FONT=20
face=3DArial =
size=3D2>news:%23jGo1GRiIHA.5088@TK2MSFTNGP02.phx.gbl</FONT></A><FONT=20
face=3DArial size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt; =
"Bob Barrows=20
[MVP]" &lt;</FONT><A href=3D"mailto:reb01501@NOyahoo.SPAMcom"><FONT =
face=3DArial=20
size=3D2>reb01501@NOyahoo.SPAMcom</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote=20
in message<BR>&gt; </FONT><A=20
href=3D"news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl"><FONT =
face=3DArial=20
size=3D2>news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>&gt;&gt; Daniel Crichton wrote:<BR>&gt;&gt; &gt; =
&amp;apos; and=20
&amp;quot; are HTML entities - these are converted by web<BR>&gt;&gt; =
&gt;=20
browsers into ' and " respectively.<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; =
If you=20
just want to print the literal characters, that's easy =
enough:<BR>&gt;&gt;=20
&gt;<BR>&gt;&gt; &gt; Response.Write """"<BR>&gt;&gt; &gt;<BR>&gt;&gt; =
&gt;=20
will print a single " (there are 4 " in that line, the two outer=20
ones<BR>&gt;&gt; &gt; are the string containers, the two inners =
generate the=20
single " as<BR>&gt;&gt; &gt; doubling them up inside a string turns =
them into=20
a literal instead).<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; another=20
example<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; Response.Write "&lt;a=20
href=3D""</FONT><A href=3D'http://myurl.com/apage.asp"">This'><FONT =
face=3DArial=20
size=3D2>http://myurl.com/apage.asp""&gt;This</FONT></A><FONT =
face=3DArial size=3D2>=20
is a<BR>&gt;&gt; &gt; link&lt;/a&gt;"<BR>&gt;&gt; &gt; Notice how you =
just=20
double up the quotation marks.<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; For =
an=20
apostrophe you don't need to do anything special:<BR>&gt;&gt; =
&gt;<BR>&gt;&gt;=20
&gt; Response.Write "They're not here"<BR>&gt;&gt; &gt;<BR>&gt;&gt; =
&gt; So=20
what problem are you having with quotes and apostrophes?<BR>&gt;&gt;=20
&gt;<BR>&gt;&gt;<BR>&gt;&gt; From the original post: "my code using=20
response.write replaces " character<BR>&gt;&gt; with =
question<BR>&gt;&gt;=20
mark"<BR>&gt;&gt;<BR>&gt;&gt; It's most likely a codepage problem. =
I've been=20
holding back from replying<BR>&gt; to<BR>&gt;&gt; this because Anthony =

typically has the most reliable advice for these<BR>&gt;&gt;=20
situations.<BR>&gt;&gt;<BR>&gt; <BR>&gt; Thanks for the vote of =
confidence Bob=20
but it baffles me.&nbsp; ;)<BR>&gt; <BR>&gt; Since " is within the =
lower ascii=20
range 0-127 the only encoding that could<BR>&gt; screw this up would =
be=20
UTF-16.&nbsp; But if the browser thought it was getting<BR>&gt; say=20
Windows-1252 and yet the server was encoding to UTF-16 (or vice =
versa)<BR>&gt;=20
the content would be completely garbled.<BR>&gt; <BR>&gt; I suspect =
that what=20
the OP thinks is happening and what actually is are very<BR>&gt;=20
different.&nbsp; Like Dan says I think we would need to see some =
actual code=20
to<BR>&gt; make sense of this.<BR>&gt; <BR>&gt; -- <BR>&gt; Anthony =
Jones -=20
MVP ASP/ASP.NET<BR>&gt; <BR>&gt;</FONT> </BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0129_01C88ADD.5AD9D550--


Re: printing character ' and " in asp using vbscript by S

S
Mon Mar 24 11:10:13 CDT 2008

This is a multi-part message in MIME format.

------=_NextPart_000_0014_01C88DF7.A5491D90
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

you have guessed it right, i am copying the text from ms word but am =
cleaning wordhtml using wordcleaner 3.=20
further, i checked using=20
Response.CharSet =3D "UTF-8"=20
in this case the ? characters appears on every newline including the =
places where it was appearing earlier.

when i use
<%Response.CharSet =3D "Windows-1252"%>

still the problem of question marks remain. but it appears only as was =
appearing earlier (in place of " and not on every new line)
i checked the view source- the server is sending ? character itself to =
the browser.
when i checked the database field, it is showing in invalid character in =
the shape of a rectangle stored where i want the double quote " =
printed.

please help.
"Anthony Jones" <Ant@yadayadayada.com> wrote in message =
news:ejiWc1tiIHA.5780@TK2MSFTNGP06.phx.gbl...
My guess is that they are not " " but are ' " " typically cut'n'pasted =
in from Microsoft Word.

These are still in the Windows-1252 range of characters but are not =
strictly in the iso-8859-1 set.

Don't use http-equiv meta tags use real headers instead.

IOW ditch the meta tags and include this:-

<%Response.CharSet =3D "Windows-1252"%>

I'm not hopeful because you are probably using IE and IE will treat =
ISO-8859-1 as Windows-1252 anyway.

Always use Server.HtmlEncode on values retrieved from the Database. =
Stop mucking about with any other approach.

If that doesn't work view the html source from the browser. What is =
the server actually sending.

Another alternative is stop using Windows-1252.

Save your pages as UTF-8 change the codepage at the top of the page to =
65001 and include Response.CharSet =3D "UTF-8" in your page.

BTW, Have you looked at the field content directly using the DB =
management tool?


--=20
Anthony Jones - MVP ASP/ASP.NET
"S N" <uandme72@yahoo.com> wrote in message =
news:OgWpL$piIHA.4344@TK2MSFTNGP03.phx.gbl...
i am attaching the sample code. actually i am printing from a field =
in access database. the text entered in the database contains single =
quotes and double quotes. when i try to print them using response.write, =
the double quotes are getting replaced with question marks. i have tried =
the method of=20

DataPrep =3D Replace(DataPrep, """", "&quot;")

still problem remains.

i also tried
response.write(server.htmlencode(myrs(3))) ' where myrs is adodb =
recordset

still the problem remains

i am also attaching the header lines from my asp page

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@LANGUAGE=3D"VBSCRIPT" CODEPAGE=3D"1252"%>


<HTML><HEAD>
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1" />
<meta http-equiv=3D"Content-Language" content=3D"en-us" />

the problem is still not solved

please help



"Anthony Jones" <Ant@yadayadayada.com> wrote in message =
news:%23jGo1GRiIHA.5088@TK2MSFTNGP02.phx.gbl...
> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl...
>> Daniel Crichton wrote:
>> > &apos; and &quot; 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=3D""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"
>>
>> 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.
>>
>=20
> Thanks for the vote of confidence Bob but it baffles me. ;)
>=20
> 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.
>=20
> 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.
>=20
> --=20
> Anthony Jones - MVP ASP/ASP.NET
>=20
>
------=_NextPart_000_0014_01C88DF7.A5491D90
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.3157" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>you have guessed it right, i am copying =
the text=20
from ms word but am cleaning wordhtml using wordcleaner 3. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>further, i checked using </FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New =
Roman">Response.CharSet =3D=20
"UTF-8" </FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>in this case&nbsp;the ? characters =
appears on every=20
newline including the places where it was appearing =
earlier.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>when i use</FONT></DIV>
<DIV><FONT size=3D2>&lt;%Response.CharSet =3D =
"Windows-1252"%&gt;</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>still the problem of question marks remain. but it =
appears=20
only as was appearing earlier (in place of " and not on every new=20
line)</FONT></DIV>
<DIV><FONT size=3D2>i checked the view source- the server is sending ? =
character=20
itself to the browser.</FONT></DIV>
<DIV><FONT size=3D2>when i checked the database field, it is showing in =
invalid=20
character in the shape of a rec