Jump to content

Problems reading left and right quotes from file.


Parodious

Recommended Posts

I am trying to read in the content of a file with the php file() function and when I do then all the left and right quotes “” and ‘’ are conveted to odd characters.

 

so this:

 

Downtown is ‘sole focus’

 

becomes this:

 

Downtown is Ôsole focusÕ��

 

I read the file like this

 

$array = file($_FILES['tmp_name']);

$headline = $array[0];

echo $headline;

 

any help would be most apprecated.

Those are "smart quotes" from a Microsoft generated file (most likely).

 

You probably want to read this article

 

You can also try this code that I found in http://docforge.com/wiki/PHP

<?php
$from = array(chr(145), chr(146), chr(147), chr(148));
$to = array("'", "'", '"', '"');
$string = str_replace($from, $to, $string);
?>

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.