|
Prev: some users cannot open asp page or see some images on the intranet
Next: ASP with XML isn't working :-(
From: Anthony Jones on 20 Mar 2008 18:54 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 = "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 = "UTF-8" in your page. BTW, Have you looked at the field content directly using the DB management tool? -- Anthony Jones - MVP ASP/ASP.NET "S N" <uandme72(a)yahoo.com> wrote in message news:OgWpL$piIHA.4344(a)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 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(a)yadayadayada.com> wrote in message news:%23jGo1GRiIHA.5088(a)TK2MSFTNGP02.phx.gbl... > "Bob Barrows [MVP]" <reb01501(a)NOyahoo.SPAMcom> wrote in message > news:%233n2yuBiIHA.4744(a)TK2MSFTNGP06.phx.gbl... >> 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" >> >> 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 > >
From: S N on 24 Mar 2008 12:10 you have guessed it right, i am copying the text from ms word but am cleaning 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 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(a)yadayadayada.com> wrote in message news:ejiWc1tiIHA.5780(a)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 = "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 = "UTF-8" in your page. BTW, Have you looked at the field content directly using the DB management tool? -- Anthony Jones - MVP ASP/ASP.NET "S N" <uandme72(a)yahoo.com> wrote in message news:OgWpL$piIHA.4344(a)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 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(a)yadayadayada.com> wrote in message news:%23jGo1GRiIHA.5088(a)TK2MSFTNGP02.phx.gbl... > "Bob Barrows [MVP]" <reb01501(a)NOyahoo.SPAMcom> wrote in message > news:%233n2yuBiIHA.4744(a)TK2MSFTNGP06.phx.gbl... >> 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" >> >> 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 > >
From: S N on 24 Mar 2008 12:14 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(a)yadayadayada.com> wrote in message news:ejiWc1tiIHA.5780(a)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 = "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 = "UTF-8" in your page. BTW, Have you looked at the field content directly using the DB management tool? -- Anthony Jones - MVP ASP/ASP.NET "S N" <uandme72(a)yahoo.com> wrote in message news:OgWpL$piIHA.4344(a)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 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(a)yadayadayada.com> wrote in message news:%23jGo1GRiIHA.5088(a)TK2MSFTNGP02.phx.gbl... > "Bob Barrows [MVP]" <reb01501(a)NOyahoo.SPAMcom> wrote in message > news:%233n2yuBiIHA.4744(a)TK2MSFTNGP06.phx.gbl... >> 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" >> >> 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 > >
From: S N on 24 Mar 2008 12:39 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 appearing on the server. please help "S N" <uandme72(a)yahoo.com> wrote in message news:%23m$1focjIHA.748(a)TK2MSFTNGP04.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(a)yadayadayada.com> wrote in message news:ejiWc1tiIHA.5780(a)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 = "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 = "UTF-8" in your page. BTW, Have you looked at the field content directly using the DB management tool? -- Anthony Jones - MVP ASP/ASP.NET "S N" <uandme72(a)yahoo.com> wrote in message news:OgWpL$piIHA.4344(a)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 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(a)yadayadayada.com> wrote in message news:%23jGo1GRiIHA.5088(a)TK2MSFTNGP02.phx.gbl... > "Bob Barrows [MVP]" <reb01501(a)NOyahoo.SPAMcom> wrote in message > news:%233n2yuBiIHA.4744(a)TK2MSFTNGP06.phx.gbl... >> 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" >> >> 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 > >
From: S N on 24 Mar 2008 12:46
i 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(a)yahoo.com> wrote in message news:uPZpO2cjIHA.4396(a)TK2MSFTNGP04.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 appearing on the server. please help "S N" <uandme72(a)yahoo.com> wrote in message news:%23m$1focjIHA.748(a)TK2MSFTNGP04.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(a)yadayadayada.com> wrote in message news:ejiWc1tiIHA.5780(a)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 = "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 = "UTF-8" in your page. BTW, Have you looked at the field content directly using the DB management tool? -- Anthony Jones - MVP ASP/ASP.NET "S N" <uandme72(a)yahoo.com> wrote in message news:OgWpL$piIHA.4344(a)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 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(a)yadayadayada.com> wrote in message news:%23jGo1GRiIHA.5088(a)TK2MSFTNGP02.phx.gbl... > "Bob Barrows [MVP]" <reb01501(a)NOyahoo.SPAMcom> wrote in message > news:%233n2yuBiIHA.4744(a)TK2MSFTNGP06.phx.gbl... >> 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" >> >> 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 > > |