0

I got a MS SQL table for translation of my webpagel, when I change my language to german there are words what are not shows properly an example in DB:

EL_ID   TEXT_EN TEXT_DE
el10    Reset   Löschen

but when I use in my html/php page it is not showing properly:

[10] => Array
        (
            [0] => el10
            [1] => L�schen
        )

in my webpage I got activated:

<!DOCTYPE html>
<HTML>
  <HEAD>
    <meta charset="UTF-8">
    <TITLE>
    </TITLE>
...

It is the data what is carried out from the DB or the HTML presentation the issue?

darzu
  • 33
  • 7
  • https://phpbestpractices.org/#utf-8 - to put it short, your encoding is wrong. should display a german umlaut. – steros Oct 29 '18 at 10:28
  • I was using ADODB for DB connection I needed to insert in my connection string the following parameter `$db->setConnectionParameter('CharacterSet','UTF-8');` – darzu Oct 31 '18 at 07:16

2 Answers2

0

I found this to be a good resource for any case of encoding problems:

  • For HTML content, specify UTF-8 as the encoding:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
  • Set UTF-8 as the default character set for all database connections. It however looks like MSSQL doesn't really support UTF-8.

Michael Bolli
  • 1,993
  • 2
  • 16
  • 19
  • I resolved the issue, because I am using ADODB I needed to set the right parameter for db connection `$db->setConnectionParameter('CharacterSet','UTF-8');` – darzu Oct 31 '18 at 07:18
0

Three questions:

  • what is the type of column TEXT_DE?? Should be nvarchar or ntext

  • how did you add value in column TEXT_DE - copy & paste from file - maybe file was saved in different coding system

  • what is collation of DB or that table? Run below queries

    SELECT CONVERT (varchar, SERVERPROPERTY('collation'));

    SELECT name, collation_name FROM sys.databases;

krissus
  • 39
  • 2
  • I found the solution I am using ADODB needed to insert `$db->setConnectionParameter('CharacterSet','UTF-8');` – darzu Oct 31 '18 at 07:17