Jump to content

Printing trademark character


Recommended Posts

I am trying to print a trademark symbol to a PDF using PHP. Problem is I can't get it to work. Well, actually I can but only if I copied the symbol out of Word and put it directly into my code. Like this:echo "Trademark: ™";This works but I'd like to be able to do it without having to explicitly use the ™ character (Ie, by using ASCII values maybe). Except I don't know the ASCII value. So I tried this:echo ord('™');and got a value of 226. I tried to use that in the chr() function like so:echo chr(226);but unfortunately that doesn't work. I just get the little 'unknown' question mark thingy. So I started looking at HTML entities and found that & #153; will print a ™ character. So I tried:echo chr(153);but I still get the unknown symbol.I'm afraid that there may be repercussions if I leave the ™ character directly in my code but I don't know any other way to print it. Is there another way? Could there be negative repercussions from having ™ in my code?Any advice is welcome and appreciated. Thanks.EDIT:Well, I figured it out. For some reason FireFox seemed to be caching the character encoding but not the content. :) I was testing this in an HTML page, and when I would add lines it updated the page with the new content. I also tried each of my new additions with and without the following header:header("Content-Type: text/html; charset=utf-8");Ie, I would make a modification. Run it with that header. Comment the header and run it again. On a whim I cleared cache, and all of a sudden chr(153) started printing . (This was without the header) I added the header, cleared cache and it stopped working again....removed the header but didn't clear cache this time and it still didn't work....cleared cache and it worked again...very odd.... :)So in light of my discovery, I have a new question. Is this expected behaviour?

Edited by ShadowMage
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

  • Create New...