• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Codeigniter UTF-8 in loaded view within another view

#1
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?
Reply

#2
What is the encoding of the saved view file?
Reply

#3
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"
Reply

#4
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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.