mysql - encoding post information in php and storing it in DB -
so have problem storing information in database. inserted raw post data , words "automātiskā" ( in latvian ) appears "autom?tisk?". encoded data :
$data = array( 'marka' => utf8_encode($this->input->post('marka')), etc
( developing codeigniter )
now "automātiskā" appears "automÄtiskÄ" , "benzīns" :"benzÄ«ns" etc.
i have tried several other things adding php header, no result, error.
i confused encoding stuff , learn easiest way put latvian characters in database (what code lines need add). information search make mind more mixed up.
also, need set database "collation" field utf8_latvian_ci or utf8_unicode_ci , becouse in default have latin1_swedish_ci .
also later need display info in page. need decoding stuff again? hear too.
thanks !!
make sure use proper (utf-8) headers in php, have db in utf-8 , should fine.
header('content-type: text/html; charset=utf-8');
for database recommend: utf8_general_ci
.
Comments
Post a Comment