utf 8 - ZF2 Doctrine2 MySql charset error -
i've setup mysql db utf8_unicode_ci collation, , tables , columns on have de same collation.
my doctrine config have set names utf8 connection option , html files use utf8 charset.
the text saved on tables contain accented characters (á,è,etc).
the problem when save content db, saves strange characters, when try save iso in utf8 table. (e.g.: notÃcias)
the workaround i've found to, utf8_decode before save, , utf8_encode before printing.
that means that, reason, in between messing utf8 iso.
what might be?
thanks.
edit:
i've setup encode before saving , decode before printing, , prints correctly in db chars change to:
xptÓ -> xptÓ
this makes searching in db "xptÓ" impossible...
i print bin2hex($string);
@ each step of original workflow (i.e. without encode/decode steps).
go through each of:
- the raw
$_post
data - the values after form validation
- the values put in bound entity
- the values you'd db if query directly using pdo (get from
$em->getconnection()
) - the values populated entity on reload (can via
$em->detach($entity); $entity = $em->find('entity', $id);
)
you'd looking @ point @ output changes, , focus search there.
i double check:
- on db:
show create table 'table'
showscharset=utf8
whole table (and nothing different individual columns) - that tool use see database values (navicat, phpmyadmin) has got correct encoding set.
Comments
Post a Comment