CodeIgniter Forums
Codeigniter UTF-8 in loaded view within another view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: Codeigniter UTF-8 in loaded view within another view (/showthread.php?tid=62808)



Codeigniter UTF-8 in loaded view within another view - ZeroNine - 08-28-2015

I'm having a strange issue with loaded views in Codeigniter 3.0.1. I'm trying to display Spanish characters within my application. I have set these settings below to get Spanish displaying properly in the initial view loaded from my controller.

This is set in the main index.php of codeigniter.
Code:
header('Content-Type: text/html; charset=utf-8');


I also have set this on the top of my HTML page mark up.
Code:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

So Spanish characters in the main HTML page is displaying properly. The problem is when I try to load another view inside the main HTML file.
Code:
<html>
<body>

  spanish here //displays properly

  <?php $this->load->view("page/somepage"); //Spanish in view does not format properly ?>

</body>
</html>

Any Spanish characters loaded inside this "somepage" view is not formatting properly.
Is this a bug?


RE: Codeigniter UTF-8 in loaded view within another view - CroNiX - 08-28-2015

What is the encoding of the saved view file?


RE: Codeigniter UTF-8 in loaded view within another view - ZeroNine - 08-28-2015

I'm assuming what you are asking is what is the output for this:
echo $this->output->get_header('content-type');
inside the inner view file. It shows "text/html; charset=utf-8"


RE: Codeigniter UTF-8 in loaded view within another view - CroNiX - 08-29-2015

No, most IDE's can usually save the file with different character encodings. I'm wondering if you saved the ACTUAL file with an encoding other than utf-8.