Code Comments
Programming Forum and web based access to our favorite programming groups.To print a double quote, use two double quotes. Example: Response.Write "Here is a double quote: "". " Same for single quotes, I think. -Corey "S N" wrote: > 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 > > >
Post Follow-up to this messageBob wrote on Mon, 17 Mar 2008 06:43:16 -0400: > Daniel Crichton wrote: > 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
Post Follow-up to this messageHilary Swank , Her first lesbian sex! [url]http://www.BestGBlog.com/MediaPlayer.asp?q=726071[/url] Paula Abdul Pool Party Sex! [url]http://www.BestG
Blog.com/watch?q=726071[/url] Helen Hunt shows off her cute body! [url]http://www.BestG
Blog.com/PlayMovie.cgi?vid=726071[/url] Jennifer Aniston Pool Party Sex! [url]http://www.BestG
Blog.com/Player.wmv?watch=726071[/url] Carmen Electra With Busty Boobs Teasing & Posing! [url]http://www.BestG
Blog.com/PlayFile?id=726071[/url]
Post Follow-up to this message"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl... > Daniel Crichton wrote: > > 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
Post Follow-up to this messagei am attaching the sample code. actually i am printing from a field in acces s database. the text entered in the database contains single quotes and doub le 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 DataPrep = Replace(DataPrep, """", """) 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="VBSCRIPT" CODEPAGE="1252"%> <HTML><HEAD> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" /> the problem is still not solved please help "Anthony Jones" <Ant@yadayadayada.com> wrote in message news:%23jGo1GRiIHA.5088@TK2MSFTNGP0 2.phx.gbl... > "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message > news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl... > to > > 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 ve ry > 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 > >
Post Follow-up to this messageWithin VBScript strings, all characters are stored as 16-bit Unicode values, so you can't easily tell whether your string contains Unicode or not. Depe nding 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 -- th e W versions of things like ChrW and AscW. Here is a short script that demonstrates a message box displaying a string t hat includes a Unicode character (that looks something like a single quote) and the same string with that character removed (using a simple regular expr ession). Dim s s = "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 = "[^\u0000-\u007F]" sRemoveUnicode = .Replace(sAnyString, "") End With End Function -Paul Randall "S N" <uandme72@yahoo.com> wrote in message news:OgWpL$piIHA.4344@TK2MSFTNGP 03.phx.gbl... i am attaching the sample code. actually i am printing from a field in acces s database. the text entered in the database contains single quotes and doub le 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 DataPrep = Replace(DataPrep, """", """) 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="VBSCRIPT" CODEPAGE="1252"%> <HTML><HEAD> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" /> the problem is still not solved please help "Anthony Jones" <Ant@yadayadayada.com> wrote in message news:%23jGo1GRiIHA.5088@TK2MSFTNGP0 2.phx.gbl... > "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message > news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl... > to > > 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 ve ry > 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 > >
Post Follow-up to this messageMy guess is that they are not " " but are ' " " typically cut'n'pasted in fr om 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 = "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 mu cking about with any other approach. If that doesn't work view the html source from the browser. What is the ser ver 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 = "UTF-8" in your page. BTW, Have you looked at the field content directly using the DB management t ool? -- Anthony Jones - MVP ASP/ASP.NET "S N" <uandme72@yahoo.com> wrote in message news:OgWpL$piIHA.4344@TK2MSFTNGP 03.phx.gbl... i am attaching the sample code. actually i am printing from a field in acces s database. the text entered in the database contains single quotes and doub le 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 DataPrep = Replace(DataPrep, """", """) 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="VBSCRIPT" CODEPAGE="1252"%> <HTML><HEAD> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" /> the problem is still not solved please help "Anthony Jones" <Ant@yadayadayada.com> wrote in message news:%23jGo1GRiIHA.5088@TK2MSFTNGP0 2.phx.gbl... > "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message > news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl... > to > > 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 ve ry > 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 > >
Post Follow-up to this messageyou have guessed it right, i am copying the text from ms word but am cleanin g wordhtml using wordcleaner 3. further, i checked using Response.CharSet = "UTF-8" in this case the ? characters appears on every newline including the places where it was appearing earlier. when i use <%Response.CharSet = "Windows-1252"%> still the problem of question marks remain. but it appears only as was appea ring earlier (in place of " and not on every new line) i checked the view source- the server is sending ? character itself to the b rowser. 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.578 0@TK2MSFTNGP06.phx.gbl... My guess is that they are not " " but are ' " " typically cut'n'pasted in fr om 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 = "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 mu cking about with any other approach. If that doesn't work view the html source from the browser. What is the ser ver 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 = "UTF-8" in your page. BTW, Have you looked at the field content directly using the DB management t ool? -- Anthony Jones - MVP ASP/ASP.NET "S N" <uandme72@yahoo.com> wrote in message news:OgWpL$piIHA.4344@TK2MSFTNGP 03.phx.gbl... i am attaching the sample code. actually i am printing from a field in acces s database. the text entered in the database contains single quotes and doub le 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 DataPrep = Replace(DataPrep, """", """) 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="VBSCRIPT" CODEPAGE="1252"%> <HTML><HEAD> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" /> the problem is still not solved please help "Anthony Jones" <Ant@yadayadayada.com> wrote in message news:%23jGo1GRiIHA.5088@TK2MSFTNGP0 2.phx.gbl... > "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message > news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl... > to > > 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 ve ry > 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 > >
Post Follow-up to this messagei changed the codepage tp 65001 and charset to utf-8, then the question mark ? showing earlier, has changed to the rectangle as shown below. ‘ the database field also shows the same character stored in it. please help. "Anthony Jones" <Ant@yadayadayada.com> wrote in message news:ejiWc1tiIHA.578 0@TK2MSFTNGP06.phx.gbl... My guess is that they are not " " but are ' " " typically cut'n'pasted in fr om 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 = "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 mu cking about with any other approach. If that doesn't work view the html source from the browser. What is the ser ver 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 = "UTF-8" in your page. BTW, Have you looked at the field content directly using the DB management t ool? -- Anthony Jones - MVP ASP/ASP.NET "S N" <uandme72@yahoo.com> wrote in message news:OgWpL$piIHA.4344@TK2MSFTNGP 03.phx.gbl... i am attaching the sample code. actually i am printing from a field in acces s database. the text entered in the database contains single quotes and doub le 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 DataPrep = Replace(DataPrep, """", """) 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="VBSCRIPT" CODEPAGE="1252"%> <HTML><HEAD> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" /> the problem is still not solved please help "Anthony Jones" <Ant@yadayadayada.com> wrote in message news:%23jGo1GRiIHA.5088@TK2MSFTNGP0 2.phx.gbl... > "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message > news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl... > to > > 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 ve ry > 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 > >
Post Follow-up to this messagei have changed the codepage and charset on all pages of my website to 65001 and utf-8. but now even apostrophe is showin as a rectangle or strange character. please help. "S N" <uandme72@yahoo.com> wrote in message news:uPZpO2cjIHA.4396@TK2MSFTNGP 04.phx.gbl... i am sorry, but the character showing as rectangle in my pc during composing of the message to this group, is now showing as ' in the message finally a ppearing on the server. please help "S N" <uandme72@yahoo.com> wrote in message news:%23m$1focjIHA.748@TK2MSFTNG P04.phx.gbl... i changed the codepage tp 65001 and charset to utf-8, then the question mark ? showing earlier, has changed to the rectangle as shown below. ' the database field also shows the same character stored in it. please help. "Anthony Jones" <Ant@yadayadayada.com> wrote in message news:ejiWc1tiIHA.578 0@TK2MSFTNGP06.phx.gbl... My guess is that they are not " " but are ' " " typically cut'n'pasted in fr om 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 = "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 mu cking about with any other approach. If that doesn't work view the html source from the browser. What is the ser ver 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 = "UTF-8" in your page. BTW, Have you looked at the field content directly using the DB management t ool? -- Anthony Jones - MVP ASP/ASP.NET "S N" <uandme72@yahoo.com> wrote in message news:OgWpL$piIHA.4344@TK2MSFTNGP 03.phx.gbl... i am attaching the sample code. actually i am printing from a field in acces s database. the text entered in the database contains single quotes and doub le 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 DataPrep = Replace(DataPrep, """", """) 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="VBSCRIPT" CODEPAGE="1252"%> <HTML><HEAD> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" /> the problem is still not solved please help "Anthony Jones" <Ant@yadayadayada.com> wrote in message news:%23jGo1GRiIHA.5088@TK2MSFTNGP0 2.phx.gbl... > "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message > news:%233n2yuBiIHA.4744@TK2MSFTNGP06.phx.gbl... > to > > 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 ve ry > 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 > >
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.