WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-30-2007, 03:54 PM
Brendan Brendan is offline
WebProWorld New Member
 

Join Date: Jan 2006
Posts: 2
Brendan RepRank 0
Default How do I store special html codes in a database?

I am making an asp.net website for a client. A large portion of the site deals with their product database. The best part is that I received their product database as a Microsoft Word document filled with tables.

So... Converting the word doc to Excel and then importing that into MSSQL 2005 was no trouble. Everything displays fine and the database holds all the data just fine. However, all of their products are labeled with the registered or trademark symbols.

My question is what would be the best way to store these symbols and then display them?

1. Store them as the actual character? (ie: press alt+174 for ®)

2. Store them as their html code? (ie: ® or ®)

When displaying the webpage would I then need to worry about the character set that I specify? Would it have to be anything different than the most common or default?

Any thoughts would be helpful. Thanks.
Reply With Quote
  #2 (permalink)  
Old 11-30-2007, 05:45 PM
DaveSawers's Avatar
DaveSawers DaveSawers is offline
WebProWorld Veteran
 

Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 328
DaveSawers RepRank 1
Default Re: How do I store special html codes in a database?

Store them as their HTML codes.
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
  #3 (permalink)  
Old 11-30-2007, 06:20 PM
Brendan Brendan is offline
WebProWorld New Member
 

Join Date: Jan 2006
Posts: 2
Brendan RepRank 0
Default Re: How do I store special html codes in a database?

Any reason why, DaveSawers? If I do store them as their HTML codes how would I go about handling the display? I encode all user input as I display it on a webpage so that it cannot affect my design either by accident or by maliciousness. Won't storing the HTML codes then result in double encoded output?

Just to try to throw you off just a bit, I don't know if the client will use this database for purposes other than the web. What if my client uses this database to pull information for a print company or vendor specific application that doesn't handle HTML codes?

Am I thinking too hard about this? Should I just let the client deal with it when they try to? That sure seems pretty unprofessional to me.
Reply With Quote
  #4 (permalink)  
Old 12-01-2007, 08:12 AM
DaveSawers's Avatar
DaveSawers DaveSawers is offline
WebProWorld Veteran
 

Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 328
DaveSawers RepRank 1
Default Re: How do I store special html codes in a database?

Because then they will always display properly on a web page.

Use htmlentities (in PHP) to encode the strings for storage on the database and then, if you need them translated back again for use elsewhere, use html_entity_decode. Presumably there are ASP.NET equivalents for these PHP functions.
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
  #5 (permalink)  
Old 12-04-2007, 12:50 AM
mwall mwall is offline
WebProWorld New Member
 

Join Date: Aug 2007
Posts: 8
mwall RepRank 0
Default Re: How do I store special html codes in a database?

Server.HTMLEncode might be what you're after.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Doing an online store with ACCESS database? Sky Captain Content Discussion Forum 5 04-27-2007 02:10 PM
SEO & Validation Of HTML Codes math Search Engine Optimization Forum 4 02-02-2007 11:30 AM
errors in html codes bobkom Submit Your Site For Review 0 10-05-2004 08:45 AM
Email with HTML codes Astronaut Marketing Strategies Discussion Forum 1 05-27-2004 04:29 AM
Save Your Source Codes From Html Copycats, I Recommend This graysoft Search Engine Optimization Forum 0 01-12-2004 07:49 AM


Search Engine Friendly URLs by vBSEO 3.0.0