D
D
Denis Karakchiev2019-04-15 10:58:21
PHP
Denis Karakchiev, 2019-04-15 10:58:21

How to change encoding for php5.6 embedded server to windows-1251?

Historically, I have a windows-1251 encoded project, deploying it to Ubuntu with php-5.6 , etc. the built-in php server is enough for development, you need to change the encoding. I don't know much about apache and changing the encoding, so I can't do without help.
Thanks in advance for your replies.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Karakchiev, 2019-04-15
@uokersam

Decided, because a php site had to add the following to the .htaccess file at the root of the site:

DefaultLanguage ru
AddDefaultCharset windows-1251
php_value default_charset "cp1251"

Also, if the database is also in windows-1251 encoding, then you need to create it as follows (example for PostgreSQL):
And also, if postgres gave a locale error when creating the database, you need to generate the locale (example for Ubuntu)
sudo locale-gen ru_RU.CP1251

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question