PHP string functions giving garbage characters

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

 



I have a php page that reads a text file on the server.  It gets the
first line of the file and if I echo the line it appears fine. 
Anything I do after that to try to split the line generates garbage
characters (I'm guessing from mixed up encoding).

How do I control the output of php string functions so the character
encoding doesn't change on me?  I've tried using setlocale() to no avail.

Here's a sample of the code I'm using:

<?php

$myFile = "incoming/mytestfile.txt";
$fh = fopen($myFile, 'r');

$theData = fgets($fh);
fclose($fh);

print $theData;
$pieces = split(";", $theData);
echo $pieces[0];

?>


--Joe


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux