Displaying HTML tags in an Access database
Hi there!
Hopefully this is the right place to post this. If not I apologize. This is my first posting in any discussion board. Please bear with me.
Here's my problem:
I have an Access database and I would like to include html tags in the memo fields for bulleted lists...bold...italics...etc.
When this information is displayed in the browser all HTML tags embeded in the database memo field are displayed as plain text (e.g. bolded).
Is there any way I can make these tags display correctly in HTML? I'm using ASP to call on this database.
Thanks! Any help is greatly appreciated.
Suzanne posted this at 16:59 — 20th August 2003.
She has: 5,507 posts
Joined: Feb 2000
URL please.
Likely when coming out of the db, the <> are getting encoded.
m3rajk posted this at 17:46 — 20th August 2003.
They have: 461 posts
Joined: Jul 2003
my guess is that in order to insert into the db you's getting encoded to ascii or something else, so instead of having the string hey there returned you're getting (this is ascii but to show the character breask i' putting | before each string of numbers. to reproduce this open an editor and hold down alt while typing the string, or prepend the number with &# and add ; to the end and but that into an html document. that's what i think your script is doing) |060|098|062|104|101|121|032|116|104|101|114|101|060|047|098|062
while this is great for the db, it doesn't quite work right unless you convert it first
POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.
Devil's Angel posted this at 17:50 — 20th August 2003.
They have: 10 posts
Joined: Aug 2003
Unfortunately my test area is not available to the public but here's the URL of a spot I'll be needing this:
http://www.nscc.ca/Learning_Programs/part-time/Metro/qry_certificateid.asp?enterID=379
In the description if I wanted to have all references to Microsoft Office in bold; the memo field in my database would look like this:
Windows2000 and the Microsoft Office (Standard and Professional) suite of software applications has become very popular and in many cases the chosen standard within many home and business environments....
When it is called on the website it looks exaclty the same. The tags are not being parsed they are only being seen as plain text.
The ASP code I'm using to call this memo is this:
<?php
=Server.HTMLEncode(rs.Fields("Description").Value)
?>
Hope this makes sense.
Thanks!
Devil's Angel
m3rajk posted this at 18:03 — 20th August 2003.
They have: 461 posts
Joined: Jul 2003
ok. are you storing it in your db via that call? while i don't know asp it looke like it's suppossed ot be similar to php's htmlEntities or htmlSpecialChars, which actually changes <> among others into the ascii equivalents. if so you need to pare the information when you call it from your database. assuming you have something similar to preg_replace that uses the perl regular expressions, or something else ot do a regular expression replacing, then look foir the expression
and change that to
and look for
and change that to
if you have perl, which allows for non greedy, you can use < in your text as well as > by searching for
and replacing with
be forewarned, i think the function hanges it to < and > but i can't be positive. i don't know enough about the php function and i don't know asp at all even though it was made as an answer to php (although i could probably pick it up really damn quickly due to myknowledge of php)
POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.
Devil's Angel posted this at 18:20 — 20th August 2003.
They have: 10 posts
Joined: Aug 2003
The HTMLEncode is a method that applies HTML encoding to a specified string.
The Examples from W3Schools is:
The following script:
<?php
response.write(Server.HTMLEncode("The image tag: <img>"))
?>
Output:
The image tag: <img>Web browser output:
The image tag:
But when it calls on a field in my database it's not doing this. I've tried using < and > and it just shows them as plain text as well.
I'm not writing anything to this database just pulling data from it. Those in charge of this content on our website enter the data into MS Access via a form in the database.
Thanks!
Devil's Angel
m3rajk posted this at 18:34 — 20th August 2003.
They have: 461 posts
Joined: Jul 2003
because that's what a browser does., and it means it's not converting to ascii but to the html shorts. now if you're not doing any encoding, then there shouldn't be a problem, unless the people sending it TO the db do that, in which case you need to parse. again, i sugget perl for hte non-greedy ability if you have it. search for
and replace with
POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.
Mark Hensler posted this at 18:55 — 20th August 2003.
He has: 4,048 posts
Joined: Aug 2000
You will need to use this:
Server.HTMLDecode(strTextFromDB)
Devil's Angel posted this at 12:58 — 21st August 2003.
They have: 10 posts
Joined: Aug 2003
I tried using Server.HTMLDecode and it doesn't display any of the information in the field.
I've tried replacing the in the memo field with [bold] and then changing it back in my asp script and it replaces it but it still displays in the information.
Devil's Angel
Devil's Angel posted this at 13:38 — 21st August 2003.
They have: 10 posts
Joined: Aug 2003
Thanks for your help everyone! I found out what my problem is and it's working fine now.
Thanks again!
Devil's Angel
Mark Hensler posted this at 16:35 — 21st August 2003.
He has: 4,048 posts
Joined: Aug 2000
What was the solution?
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.