What is the encoding when using txt files in php?

What encoding is required in txt files and encoding of html pages when using txt files in php scripts (in the same html page)? Thanks in advance.


Answer 1, authority 100%

The encoding must be the same as on the HTML page. It is preferable to use only UTF-8 everywhere.


Answer 2, authority 33%

If you save using a text editor from windows (notepad), then ANSI (encoding) is the most “that”. In HTML, I would advise using the cp1251 encoding, although it is already outdated and it’s time to switch to utf-8, the page encoding is specified like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>

Answer 3, authority 33%

If you are serious about programming, then onlyutf8!!! There will be no problems with Russian regular seasons, for example. And in general, it is international and universal.