Parodious Posted April 4, 2007 Share Posted April 4, 2007 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. Link to comment https://forums.phpfreaks.com/topic/45619-problems-reading-left-and-right-quotes-from-file/ Share on other sites More sharing options...
kenrbnsn Posted April 4, 2007 Share Posted April 4, 2007 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 Link to comment https://forums.phpfreaks.com/topic/45619-problems-reading-left-and-right-quotes-from-file/#findComment-221627 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.