Unable to explode on 'þ' when using file_get_contents()

Viewed 298

I need to get the contents of a remote file, and then explode those contents on the symbol: "þ".

I can make it work if the string I am exploding is just a local variable, but I can't get it to work with file_get_contents();

$string = '1þClassic Los 1/10þþ15þ1þTrueþ2þCú';
$parts = explode("þ", $string);
var_dump($parts);

result:

array(8) {
  [0]=>
  string(1) "1"
  [1]=>
  string(16) "Classic Los 1/10"
  [2]=>
  string(0) ""
  [3]=>
  string(2) "15"
  [4]=>
  string(1) "1"
  [5]=>
  string(4) "True"
  [6]=>
  string(1) "2"
  [7]=>
  string(2) "Cu"
}

$string = file_get_contents('file.txt');
$parts = explode("þ", $string);
var_dump($parts);

result:

array(1) {
  [0]=>
  string(42) "1þClassic Los 1/10þþ15þ1þTrueþ2þCú"
}

Why can't I explode on that symbol when I use file_get_contents() ?

2 Answers
Related