php - Best way to insert Unicode data to the DB with latin1_general_ci -
php - Best way to insert Unicode data to the DB with latin1_general_ci -
i receive info xml file in unicode. best , right way insert/update info in mysql db fields in latin1_general_ci encoding?
thanks!
nitpick: latin1_general_ci
collation -- sorting order. encoding -- character set
-- using latin1
.
entitize unicode characters strings. after parse xml file values , before stash values in database columns. example, you'll want turn ⇨ (an arrow) ⇨
in text string before storing it.
$outstr = htmlentities ( $instr, ent_noquotes, iso8859-1);
you need read on htmlentities
because has lots of options. http://php.net/manual/en/function.htmlentities.php
when retrieve values database, can either send them straight browser, understands entitized items, or can utilize html_entity_decode()
undo entitizing operation.
php mysql unicode latin1
Comments
Post a Comment