B
B
Begginer_serg2021-12-19 22:36:06
PHP
Begginer_serg, 2021-12-19 22:36:06

Change txt file encoding?

A text file is created from wmic, with Unicode (utf-16) encoding.
When reading in a web browser (utf-8), incomprehensible characters, but if the txt file is set to utf-8 encoding via "Save as ..", then everything works fine, but how can this process be automated through python or php?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Adamos, 2021-12-19
@Adamos

If the task is only to ensure that the browser correctly displays the txt files that you have blurted out in an unknown Windows encoding, then its solution is not in PHP, but in setting up the server on which this site is running.
So that he substitutes the header for * .txt

Content-Type: text/plain; charset={та кодировка, которая реально в этих файлах}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question