0

I have my local MySQL server disabled and see appropriate PDO Exception. The problem is that all cyrillic symbols in the message are broken (message text and cyryllic symbols in path):

PDOException: SQLSTATE[HY000] [2002] ����������� �� �����������, �.�. �������� ��������� ������ ������ �� �����������. in D:\��� �������\domains\time.local\vendor\time\DB.php:25 Stack trace: #0 ...

I've found out that this text is actually in windows-1251 format (shows normal text when I switch to it manually in browser). But I have utf-8 set everywhere: in Apache I have:

AddDefaultCharset utf-8

(Apache sends proper charset header)

All php files are in UTF-8 without BOM. In php.ini I have:

default_charset = "UTF-8"

internal_encoding = "UTF-8"

input_encoding = "UTF-8"

output_encoding = "UTF-8"

So why it still uses windows-1251? And how to switch such messages to utf-8?

I also see that fatal error and other also uses windows-1251. Why?

Apache 2.4/PHP 7.0.3/Windows 10

P. S. My exception handler is quite simple:

set_exception_handler(function (\Throwable $th) {
    echo $th;
});
Steve Jorgensen
  • 11,725
  • 1
  • 33
  • 43
Audiophile
  • 970
  • 2
  • 8
  • 20

1 Answers1

1

Try execute query "SET NAMES utf8" after connection to database, maybe it helps.

Aleksandr
  • 59
  • 4