S
S
sashazaaa2015-09-27 21:26:03
PHP
sashazaaa, 2015-09-27 21:26:03

How to choose the right encoding when converting from a php file to html?

Good evening.
I have a php file that receives information from a server. I need to save this file in html. There is one problem: the text on the page is in Ukrainian. When converting with the ob_start(), ob_end_flush() and ob_get_contents() pods, the encoding is converted to utf-8 and the text is displayed as characters.
How to set up the encoding correctly?
What classes can perform this task?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
stormsher, 2015-09-27
@stormsher

iconv("windows-1251", "UTF-8", $html);
where in $html is the text in the encoding you want to change..

D
Dmitry Pavlov, 2015-09-27
@dmitry_pavlov

An article from our blog will remove all questions, I think: Data Encoding: A Guide to UTF-8 for PHP and MySQL

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question