I have a Webserver:
Win-Server (2008)
Apache 2.2.25
PHP 5.4.32
PHPinfo says default_charset: "no value"
The Database Server is a MS - SQL-Server 10.50.6000.34 With Collation "Latin1_General_CI_AS"
I connect the DB with this function:
$connection_options = array('Database' => $this -> database, 'UID'=>$this -> user, 'PWD'=>$this -> password);
$this -> connection = sqlsrv_connect($this -> server, $connection_options);
if ($this -> connection === false) {
echo "<pre>".print_r(sqlsrv_errors(), true);
throw new Exception("Datenbankverbindung nicht möglich.");
}
When a user submits some Data through a form Letters like the German "ä,ö,ü" look like this: "ü, Ü, ..."
When I read the data from the DB and do mb_convert_encoding($value, 'UTF-8')
it displays ok on the website.
Our IT now copied the DB to a SQL-Server with version 14.0.2037.2 Collation: SQL_Latin1_General_CP1_CI_AS and I had to switch to a Linux Server:
RHEL8
Apache 2.4.37
PHP 7.3.20
PHP default_charset is set to UTF-8 here.
On the new Server the "ü, Ü, ..." chars get displayed as is. The Database connection is used in the same way as on the old server.
When I change the connection options to:
$connection_options = array('Database' => $this -> database, 'UID'=>$this -> user, 'PWD'=>$this -> password, 'CharacterSet'=>'UTF-8');
It doesnt change anything.
Is there a way to convert the characters on the SQL server to they UTF-8 counterparts or can I use a differnt way to display the text from the DB on the website? Normally I´m good with google and fiddling out whats the problem but in this case im kinda stuck. :-/