I've been searching for this question, but I think it haven't been asked yet.
I have got a problem with reading via fgetc() from my file. When I need to read the apostrophe, the program replace it with ???, so I am not able to add apostrophe to my array. Here's the code (I cut it - so there's no array adding):
$file = fopen("file.txt", "r");
$read_c;
while(!feof($file)) {
while(ctype_space($read_c = fgetc($file)));
echo $read_c . " ";
}
fclose($file);
Now, when there's an apostrophe in the text in the file
’a’
I get in the terminal:
? ? ? a ? ? ?
The strange thing is, when I put in the code
echo $read_c
Instead of
echo $read_c . " "
The output is given correctly
’a’
Thank you all for you help.