[eluser]_asdf[/eluser]
Alrighty, I've tested against a default Codeigniter 1.6.1 (stable) install, replacing the welcome controller and connecting to a database with the table format:
Code:
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
`id` int(11) NOT NULL auto_increment,
`vc` varchar(255) collate latin1_general_ci default NULL,
`txt` text collate latin1_general_ci,
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
While the DB structure there specifies latin1 general, I've also tested it as utf8 general.
Welcome controller method:
Code:
function index()
{
$this->output->enable_profiler(true);
$this->load->database();
// how I'd do it
$this->db->set('vc', '1. blahblah£.java varchar');
$this->db->set('txt', '1. blahblah£.java blob');
$this->db->insert('test');
// Original poster's method
$this->db->insert('test', array('vc' => '2. blahblah£.java varchar', 'txt' => '2. blahblah£.java blob'));
}
In both instances, GBP symbol was inserted correctly. In both latin1 and utf-8. with the file saved as both ANSI and utf8 (although the profiler returns the GBP as a questionmark, typical of encoding problems, the data
is inserted correctly)
So we need more details: Database collation, the database.php specified collation. The data you're inserting, and any validation/filtering its going through. Is XSS clean enabled? etc.
XML output of the table:
Code:
<char_test>
<!-- Table test -->
<test>
<id>1</id>
<vc>1. blahblah£.java varchar</vc>
<txt>1. blahblah£.java blob</txt>
</test>
<test>
<id>2</id>
<vc>2. blahblah£.java varchar</vc>
<txt>2. blahblah£.java blob</txt>
</test>
<test>
<id>3</id>
<vc>1. blahblah£.java varchar</vc>
<txt>1. blahblah£.java blob</txt>
</test>
<test>
<id>4</id>
<vc>2. blahblah£.java varchar</vc>
<txt>2. blahblah£.java blob</txt>
</test>
</char_test>