issues with UTF8 and ANSI

#1
[eluser]Valhallen[/eluser]
I'm a bit dumb when it comes to encodings. So please, bear with me.

When creating my own content, be it libraries, configs, models, controllers etc, I always encode them in utf8 without bom. I have a live site running PHP5.3.3 (CGI), Apache 2.2.13, Unix with Codeigniter 2.0.2 and Smarty 3.0.8. It works just fine.

But recently I started developing it again and at first I used CI 2.0.2 but moved to 2.0.3 and now on to the latest github version.

So, the issue is that SOME of my utf8 files are creating whitespace and that screws up the outputted HTML. I did the following tests:

First test
1. downloaded latest CI from github
2. created a small library
Code:
<?php
class Test
{
public function __construct()
{
  
}
}
3. saved the file as utf8 w/o bom
4. added it to autoload.php

all good, so far. no whitespace yet.


Second test
1. I created an additional library called Smarty_wrapper with this code:
Code:
<?php
require_once APPPATH.'third_party/smarty/Smarty.class.php';
class Smarty_wrapper extends Smarty
{
public function __construct()
{
  parent::__construct();
}
}
2. saved it as utf8. this created whitespace.
3. saved it as ansi. this fixed the whitespace issue.


Third test
1. saved test.php as ansi. now both the test and smarty wrapper are ansi. all good. works fine.
2. saved smarty wrapper to utf8. now test is ansi and smarty_wrapper is utf8 (this encoding previously created whitespace with given file). works great. no whitespace.

--

so these tests show that both libraries can't be simultaneously encoded in utf8.

what's going on here? should I convert all my files to ansi? and why hasn't this issue occured with the live version?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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