Jump to content

Trademark Symbol In Database


ShadowMage
 Share

Recommended Posts

Hi,I have a bit of a situation. I have some information in a database that needs to have a trademark symbol (™) when it displays in the browser. I tried copying the symbol from MS Word, but that didn't show up. So I decided to store raw html entities in the db (™) but that isn't a good solution either because it is possible for other symbols, like &, to be in there and storing raw entities for each and every possible symbol is ridiculous.So the solution I've implemented now is this:I store the information with something like this, ( TM ), where I want the symbol.When I retrieve the data, I use htmlentities() to convert all other symbols and then use str_replace() to replace the ( TM ) with ™**There are no spaces in the ( TM ) but I needed to put them in otherwise BB Code translated them to

$data = htmlentities($recordset['DataField']);$newValue = str_replace("(TM)",  "™", $data);

Is there a better way to do this?Please advise.Thanks,jkloth

Edited by jkloth
Link to comment
Share on other sites

Why exactly is storing ™ in the database a bad idea?
Because there can be other symbols like & and " in there and I don't want to have to enter & and " in the database everytime I need a & or ". And if I have a mixture of ™ and & then using htmlentities won't work.
Link to comment
Share on other sites

But if they submit an actual ™ character, then you should be able to use htmlentities to convert that to ™ automatically, along with the other characters. You could also allow your special sequence instead of the ™ character, and convert that manually.

Link to comment
Share on other sites

But if they submit an actual character, then you should be able to use htmlentities to convert that to ™ automatically, along with the other characters. You could also allow your special sequence instead of the character, and convert that manually.
The table where this info is stored is manually entered data. The table stores different categories which are then used to populate a drop down list.
Link to comment
Share on other sites

If it works, then I guess it's good enough. I wasn't sure what the information in post 5 was for, the suggestion I had in post 4 doesn't matter what you use the data for.
Sorry, guess I should have explained myself a bit more.
But if they submit an actual character, then you should be able to use htmlentities to convert that to ™ automatically, along with the other characters. You could also allow your special sequence instead of the character, and convert that manually.
The table where this info is stored is manually entered data. The table stores different categories which are then used to populate a drop down list.
What I meant here was that the data is not submitted from anywhere. It's manually entered into the MySQL Database through OpenOffice Base. So you're suggestion would not apply since there is no submitting going on. I am only reading from the table in my code.So what I wanted to know is if there was a better way to store the information. My solution works though so I guess I'll stick with it.Thanks, justsomeguy.
Link to comment
Share on other sites

I was planning on building a database manager onto the project in the future so I could use that to add new data instead of interacting directly with the db. I'll have to keep your suggestions in mind when I get around to building the db manager.Thanks again, jsg

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...