Welcome Guest, Not a member yet? Register   Sign In
Problem with pound (£) in MySQL AR insert statements
#8

[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>
  &lt;!-- Table test --&gt;
    <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>


Messages In This Thread
Problem with pound (£) in MySQL AR insert statements - by El Forum - 04-12-2008, 12:54 AM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 04-12-2008, 05:03 AM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 04-12-2008, 05:08 AM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 04-12-2008, 05:11 AM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 04-12-2008, 07:10 AM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 04-12-2008, 08:04 AM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 04-12-2008, 09:10 AM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 04-13-2008, 07:43 AM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 01-12-2009, 04:27 PM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 01-12-2009, 04:36 PM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 01-12-2009, 04:36 PM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 01-12-2009, 04:50 PM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 01-12-2009, 04:57 PM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 01-12-2009, 05:02 PM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 01-12-2009, 05:14 PM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 01-12-2009, 05:21 PM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 01-12-2009, 05:28 PM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 01-12-2009, 05:40 PM
Problem with pound (£) in MySQL AR insert statements - by El Forum - 01-12-2009, 05:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB