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

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -