K
K
KrylCW2015-10-22 13:15:21
Apache HTTP Server
KrylCW, 2015-10-22 13:15:21

How can I override the encoding set in the HTTP header by the executed script using Apache 2?

There is a script that sets its charset in HTTP headers. This charset is not suitable for our needs, the script sets UTF-8, the content is encoded in Windows-1251, I can’t recode the content - other services will fall off. The script is maintained by a third party (opensource). In order to avoid problems during further updates, I would like to leave the script as it is and change the header using Apache 2. Is it possible?
I tried AddDefaultCharset, but the script interrupts this parameter.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Cat Anton, 2015-10-22
@KrylCW

If you just change the title, it will not give you anything. The content will remain in UTF-8. There is only one way out - to recode the response from UTF-8 to Windows-1251, and then use it for your needs.
Then there are the following options:
1. For the necessary files in the Apache config, try to set:

Header set Content-Type "text/html; charset=Windows-1251"

2. Convert "on the fly" content to UTF-8 using:
httpd.apache.org/docs/2.2/mod/mod_charset_lite.html
3. Find and fix the jamb in the script, because this should not be, that the encoding is in the header one and the content in the other.

A
Azazel PW, 2015-10-22
@azazelpw

How do you imagine that? )
Apache web server that gives the code to the browser on the port.
Your code is executed on the user's computer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question