--- Wade Smart <[EMAIL PROTECTED]> wrote:

> Im importing data from another site and Im having a bit of a problem. I 
> have what my browser calls: invalid characters. Its the degree symbol 
> when used with 'F or 'C. There are others though too.
> 
> I wrote a script to find chr(248) and change it to ' but its not 
> working. So, is there a way to get the character to show up in the first 
> place?
> 
> Wade

You mention in your other post that you are grabbing the contents with the
file() command which stores it in an array which you loop through.  You can use
regular expressions to perform the replace of the character.  It is usually
best to find the octal value of the character.  On a Unix/Linux system you
could do this by taking a couple of lines and viewing it with the od (octal
dump) command.

If it is decimal 248 then the octal value would be 370.  In regular expressions
the search pattern would be something like this:

/\0370/g

$output = preg_replace("/\0370/g", "'", $input);

The other option is to take the values on each line and process them with
htmlentities() to convert them to &deg; (aka &#176;) so they will display
properly in the browsers.

James

Reply via email to