PHPStorm有时只对查询进行查询

So i got this query in my File if i run the code

$query = "SELECT * FROM dbo.V_Admin_Hülse ORDER BY Kaliber DESC"; 
$sql = $conn->query($query);

this is $conn it is in a diffrent file but required:

$conn = new PDO("sqlsrv:server=$serverName;Database = $database;", $uid, $pwd);
$conn->setAttribute(PDO::SQLSRV_ATTR_ENCODING, PDO::SQLSRV_ENCODING_UTF8);

if i run the file in debug and look into $query it reads:

$query = SELECT * FROM dbo.V_Admin_Hülse ORDER BY Kaliber DESC

And there is no problem running it. In a different file i got another Statment with an umlaut

$query = "SELECT * FROM dbo.T_Geschossform ORDER BY Abkürzung ASC";
$sql = $conn->query($query);

but when i run that in Debug i get

 $query = SELECT * FROM dbo.T_Geschossform ORDER BY Abkürzung ASC

and quits with an exception!

Why is that? And how do i get it to do it properly?

Ok i added

header('Content-Type: text/html; charset=utf-8');

and after i closed and reopend the Projekt it read

$query = "SELECT * FROM dbo.T_Geschossform ORDER BY Abk�rzung ASC"

i replaced the � with an ü and now it works fine....

Strange things are happening... Can anyone explain?