Pedro's blog: db2, mysql, php, linux and performance


DB2, Zend, ajax, and the charset codification.
22/05/2010, 11:43
Filed under: DB2,General,PHP | Tags: , , , ,

Hi again, I have to apologize because I’ve been in holidays and I didn’t write so often in last weeks.

On last week I had a problem with the codification in DB2 and the codification of the html layout.

The database is defined with this line:

db2 “CREATE DATABASE D2MU AUTOMATIC STORAGE YES ON ‘/home/db2inst1’ ALIAS D2MU USING CODESET ISO-8859-15 TERRITORY ES”

And the html layout includes this meta tag:

<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-15” />

So, if I disable the layout (with zend):

$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout()->disableLayout();

The special chars in the text obtained from the database were not show in the proper codification, what I did for fixing it? I included a line in the HTTP headers like:

header (‘Content-type: text/html; charset=ISO-8859-15‘);

And the problem was solved!