Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

""""" character problem 1

Status
Not open for further replies.

weblead

Technical User
Sep 18, 2003
32
AT
Hi all,

I had a web survey form inputting into a MS Access database. The results displayed fine on a web page. At the end of the survey period the end user wanted to use the mdb file to produce printed reports etc in Access, filtering the quite considerable data into logical areas. I just copied the db file off the server and sent it to them.

Problem: all the " in the text came out as & q u o t; in the database, there were many, also a few & a m p . The user corrected all of them by hand.......

Ok so I should have thought ahead, but I am a bit new to the dynamic stuff.

I have a chance to redeem myself, they want to do the same thing again on a different subject. But they are not keen on the & q u o t; 's ;-)

I post the form to a preview page, so they can check their input before they submit, which also has a hidden form which is populated with request.form, this is then submitted using a standard form submit button.

When and what do you need to do to change the & q u o t; characters into a " before it goes to the database please?

The text areas in the form are the only places that will have these types of character, in case that helps....


Thanks in advance for any help.
 
What are you using to create these pages, Dreamweaver or something? Normally if you enter a " into a TEXTAREA it's saved to the database as ". It's sounds like there is some code happening that is using the replace function to change " to quot; before committing the data to the db. One simple solution is to leave it alone. When they want reports, instead of copying the table, run a query (in Access) on the table using the replace function on the columns that contain the undesirable stuff:
NewText:replace(replace([TextColumn],"quot;",Chr(34),"amp;","&")
Then copy the query for them.
The other solution is to alter your page code.

Note: In the above example I was unable to use the entire quote or ampersand tags. Even when entered between
Code:
they get rendered as the actual character. So, I used quot; and amp; instead.
 
Sounds like there was a Server.HTMLEncode() applied to the text before it gets written to the review page then the encoded text is saved to the db, Rather than just encoding the text written to the page and saving the original text input.



Chris.

Indifference will be the downfall of mankind, but who cares?
 
Hmmm..... Query with replace sounds like the quick solution to me, thanks veep, good tip. I can use the old survey mdb to check it out.

You are right I am using Dreamweaver on the preview page for the insert to the DB. I must look at the DW code to see if it does convert the characters.

The original survey was a project I did a while ago using mostly DW. I am now at that intermediate stage where I am writing some simple asp pages from scratch, and I must say liking it. Shunting input from page to page and doing something with it each time is fascinating stuff and much more satisfying than using DW. If I get time I will remove the DW code from the page and use something homebrewed.


 
Footnote for anyone reading this.....

I removed the DW stuff and used straight asp/SQL to insert the record. All the special characters displayed correctly in the Access database. So both you guys were right.

Lesson learned.

Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top