loading text file with fopen - single and double quotes need to be encoded?

Hi I have simple text file that I am loading with fopen() but when I do the single and double quotes are change to odd looking characters. I recognize the problem as URL encoding but nothing seems to work. What am I missing?
Who is Participating?
try this one.

 $line_of_text = preg_replace("/'/","’",$file_handle);
can i see the text file and ur code. if possible.
waffeAuthor Commented:
Here you go:
****PHP code that loads the text file and converts each line into an element in an array and then displays a random line.*************

	$file_handle = fopen("http://dev.my.com/mod/my_theme/views/default/my1_pages/slogans.txt", "r") or die ("Unable to open file!");

	$counter = 0;
	while (!feof($file_handle)) {
		$line_of_text = fgets($file_handle);
		$sloganArray[$counter] = $line_of_text;
	$randomNum = rand(1, 63);
	print $sloganArray[$randomNum];

********the text I am opening***********
Sometimes I feel like a nut, sometimes I feel like my1 
Id walk a mile for my1 
my1  99 99/100 % pure 
With a name like my1&it has to be good 
Is it live, or is it my1? 
my1&so easy a caveman can do it. 
I want my1 
Nothing outlasts my1. It keeps going and going and going& 
Like a good neighbor, my1 is there. 
Maybe shes born with it, maybe its my1 
Youve come a long way, my1 
The my1 of champions 
my1  good to the last video 
my1&its GRE-A-A-A-T!! 
Wouldnt you like to be my1, too? 
I wish I were on my1, then everyone would be in love with me. 
Nothing beats a great pair of my1s 
The Greatest my1 on Earth 
They my1 when you cook em. 
I am stuck on my1, and my1s stuck on me! 
my1  dont leave home without it 
Its not your fathers my1 

Open in new window

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

waffeAuthor Commented:
Its actually the apostrophe that is loading wired and the above lines of text show the problem. ^
waffeAuthor Commented:
ok got it - it was not an apostrophe, or at least one on my keyboard. so I selected and do a search & replace with a normal apostrophe and all is well.

waffeAuthor Commented:
ah - that works too :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.