如何在不需要手动添加值的情况下自动设置meta标记中的字符集


how can I do to set the charset in meta tag automatically without having to manually add the value?

我正在测试Kohana Framework,从我读到的内容来看,它会在呈现页面时自动设置字符集:

请求::$instance->headers['Content-Type']='text.html;charset='。Kohana::$charset;

如何在不需要手动添加值的情况下自动设置元标记中的字符集?

<html>
     <head>
         <title> title </title>
         <meta http-equiv="Content-Type" content="text/html; ***charset=utf-8***" />
     </head>
     <body>
         <h1> test </h1>
     </body>
</html>

未经测试的代码:

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo htmlspecialchars(Kohana::$charset); ?>" />