Code Comments
Programming Forum and web based access to our favorite programming groups.>i have checked the access database. when i open the access table, >there also i am finding the rectangular block whereever i expect apostrophe . >also i have started using server.htmlencode for retrieving values from the >database. but it displays the new line characters and paragraph characters >(<BR> and <p> notations) stored in the text field as such. meaning instead of >using these characters as commands for new line it is displaying them as it is, >ie as "<BR>" and "<p>". in this way the paragraph boundaries has gone. If access is showing the wrong character that indicates the data is corrupt. If the field contains HTML (which it appears it does if it has <br> and <p> elements that you expect to be honors) then you should not be using Server.HTMLEncode. It has to be assumed that a field containing HTML is already HTML encoded. This is a long thread, I can't remember if you indicated how the data arrived in the DB in the first place. -- Anthony Jones - MVP ASP/ASP.NET
Post Follow-up to this messagei had copied the data from a word file and using control-c i had pasted it into a richtext textbox in my asp form. also please tell me how to ensure that regardless of whether the data is html encoded or not, my server.htmlencode should work alright. "Anthony Jones" <Ant@yadayadayada.com> wrote in message news:expbSYCmIHA.1208@TK2MSFTNGP05.phx.gbl... > . > of > it is, > > If access is showing the wrong character that indicates the data is > corrupt. > > If the field contains HTML (which it appears it does if it has <br> and > <p> > elements that you expect to be honors) then you should not be using > Server.HTMLEncode. It has to be assumed that a field containing HTML is > already HTML encoded. > > This is a long thread, I can't remember if you indicated how the data > arrived in the DB in the first place. > > -- > Anthony Jones - MVP ASP/ASP.NET > >
Post Follow-up to this message"S N" <uandme72@yahoo.com> wrote in message news:%23YLk4eCmIHA.1188@TK2MSFTNGP04.phx.gbl... > "Anthony Jones" <Ant@yadayadayada.com> wrote in message > news:expbSYCmIHA.1208@TK2MSFTNGP05.phx.gbl... > > >i had copied the data from a word file and using control-c i had pasted it >into a richtext textbox in my asp form. > > also please tell me how to ensure that regardless of whether the data is > html encoded or not, my server.htmlencode should work alright. > > I haven't read the whole thread, but pasting directly from Word into a rich text box is asking for trouble. I recommend pasting from Word into Notepad, then taking the result and pasting it into the Rich text box. Word sometimes does odd things with what should be "double quotes". And it retains a whole load of Word-specific formatting - often over-riding your carefully crafted css. -- Mike Brind Microsoft MVP - ASP/ASP.NET
Post Follow-up to this messagealso please tell me how to ensure that regardless of whether the data is html encoded or not, my server.htmlencode should work alright. "Mike Brind [MVP]" <paxtonend@hotmail.com> wrote in message news:OtkF6xHmIHA.1680@TK2MSFTNGP06.phx.gbl... > > "S N" <uandme72@yahoo.com> wrote in message > news:%23YLk4eCmIHA.1188@TK2MSFTNGP04.phx.gbl... > > > I haven't read the whole thread, but pasting directly from Word into a > rich text box is asking for trouble. I recommend pasting from Word into > Notepad, then taking the result and pasting it into the Rich text box. > Word sometimes does odd things with what should be "double quotes". And > it retains a whole load of Word-specific formatting - often over-riding > your carefully crafted css. > > -- > Mike Brind > Microsoft MVP - ASP/ASP.NET >
Post Follow-up to this messageGazing into my crystal ball I observed "S N" <uandme72@yahoo.com> writing in news:#YLk4eCmIHA.1188@TK2MSFTNGP04.phx.gbl: > > > "Anthony Jones" <Ant@yadayadayada.com> wrote in message > news:expbSYCmIHA.1208@TK2MSFTNGP05.phx.gbl... > i had copied the data from a word file and using control-c i had > pasted it into a richtext textbox in my asp form. > > also please tell me how to ensure that regardless of whether the data > is html encoded or not, my server.htmlencode should work alright. I would suggest using a client side script to ensure the data pasted from Word is going in correctly. Word is notorious for really bad, bloated markup. Google for WYSIWYG textarea - I like the one from The Man in Blue at [http://www.themaninblue.com/experiment/widgEditor/]. -- Adrienne Boswell at Home Arbpen Web Site Design Services http://www.cavalcade-of-coding.info Please respond to the group so others can share
Post Follow-up to this message"S N" <uandme72@yahoo.com> wrote in message news:u1pVKANmIHA.3940@TK2MSFTNGP05.phx.gbl... > "Mike Brind [MVP]" <paxtonend@hotmail.com> wrote in message > news:OtkF6xHmIHA.1680@TK2MSFTNGP06.phx.gbl... > > > also please tell me how to ensure that regardless of whether the data is > html encoded or not, my server.htmlencode should work alright. As Anthony said, if you are entering html code into the database with the idea that this takes effect when you pull it back to a web page, you do not want to server.htmlencode it. Since you are using a Rich Text Editor, I am assuming that this will apply html tags to the text on entry, and you want them to act on the output. What you really want to do is to make sure no javascript or clientside vbscript gets injected. One way to do this is just to reject any input that contains the string "<script>" in it during your server-side validation. -- Mike Brind Microsoft MVP - ASP/ASP.NET
Post Follow-up to this messageyou have guessed it very correctly that i am entering html code into the dat abase (like table tags <td> <tr> in particular) with the idea that this takes effect when it is pulled back to a web page, and hence i dont want to server.htmlencode it. can you suggest a server side validation script which does as indicated belo w by you. else can you suggest an alternate method of achieving the above (e nsuring the table tags get translated into tables on the client side). please help. > As Anthony said, if you are entering html code into the database with the > idea that this takes effect when you pull it back to a web page, you do no t > want to server.htmlencode it. Since you are using a Rich Text Editor, I a m > assuming that this will apply html tags to the text on entry, and you want > them to act on the output. > > What you really want to do is to make sure no javascript or clientside > vbscript gets injected. One way to do this is just to reject any input th at > contains the string "<script>" in it during your server-side validation. > > -- > Mike Brind > Microsoft MVP - ASP/ASP.NET > > >
Post Follow-up to this message"S N" <uandme72@yahoo.com> wrote in message news:OI%23$718mIHA.2304@TK2MSFTNGP05.phx.gbl... > > > you have guessed it very correctly that i am entering html code into the > database (like table tags <td> > <tr> in particular) with the > idea that this takes effect when it is pulled back to a web page, and > hence i dont want to > server.htmlencode it. > > can you suggest a server side validation script which does as indicated > below by you. else can you > suggest an alternate method of achieving > the above (ensuring the table tags get translated into tables > on the > client side). 'input is the posted content from the Rich Text Editor If InStr(input, "<string>") > 0 Then 'reject it Else 'process it End If -- Mike Brind Microsoft MVP - ASP/ASP.NET
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.