Re: [NOT FIXED] Re: [PHP] strip out wierd characters in a string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Thus wrote Brent Clements:
> Ok, I still have the problem.
> 
> If I echo the string to a webpage, it still contains the ?
> 
> So I viewed the source in a notepad, and the thing that shows up next to
> "string" is a TM.
> 
> I tried using htmlentities on the string that I'm echoing but the question
> mark/tm is still there.
> 
> Anybody know how to fix this?

The ? you are seeing is because the charset doesn't know what to do
with the ascii value that is contained there.

You have a couple of options to let the browser know exactly what
you mean by that character:

If before any output you specify:

  header('Content-Type: text/html; charset=iso-8859-1');

will let the browser know you want a charset that defines
what that ascii value means

Or

Because there is no entity defined the htmlentities() for 'tm' you
have to convert it yourself using the numeric entity for it:

echo str_replace("\x99", "™", $a);


Then, your 'tm' will get displayed insted of '?'.


Curt
-- 
Quoth the Raven, "Nevermore."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux