• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ASCII 239 problem

I'm facing the following problem.

I created a small view file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

&lt;html &gt;

    &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;
    &lt;style&gt;#topborder {height: 10px;
                       background-color: red;}&lt;/style&gt;

<div id="topborder"></div>
and a simple controller for viewing it:

class Test extends Controller{

  function index()

but when I loaded '/test' page - the red line is not on the top of the window.
So there is a space between browser's top border and my <div> element.

But the following controller works fine:

class Test extends Controller{

  function index()
   $buffer = $this->load->view('v_test','',TRUE);
   echo $buffer;

as I found there is an ASCII character 239 appeared at the beginnig of the file.
So I thought about BOM, but there is only one character - not three of them.
All my files are saved as UTF-8 without BOM.

I'm using UTF-8 by default.
OS Windows XP.
Apache/2.2.9 (Win32)
PHP 5.2.6
Codeigniter 1.6.3

I read a lot of forums and still have not found a solution.
Maybe someone here has met such a probelm before?

I know this thread is long since dead, but I had the same kind of problem using a different php framework and I wanted to post a solution for others.

The cause of the problem is that the template file is encoded in UTF-8. Changing it to a different encoding, like ANSI, makes the mystery character go away.

There may be another way, like setting php to play better with UTF-8 files, but this solved my immediate problem.

It's not a problem, the problem is when you copy the file and paste in to a new html document then change it to utf8 with no BOM the character will still be there!

Or when you already have the html document and then you change it to utf8 with no BOM the character will still be there because it is saved with the document!

The correct way is to create a new html document with utf8 and no BOM, then paste the code into it.
I do this all of the time and have no problems.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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