PHP mysql fixed connection to utf8, but now existing greek data is useless -


i have mysql database storing fields in greek characters. in html have charset=utf-8 , database columns defined encoding utf_general_ci. not setting connection encoding far. result have database doesn't display greek characters well, when reading in php, shows well.

now try right way, added in database functions.

     $mysqli->set_charset("utf8"); 

this works great new entries.

but existing entries, problem when read data in php, comes garbled, since connection encoding has changed.

is there way fix data , make them useful again? can continue working old way, know it's wrong , can cause me more problems in future.

i solved issue follows:

  1. in php script, retrieve information now, i.e without setting connection. way mistake inverted , corrected , in php file have characters in correct utf-8 format.
  2. in same php script, write information setting connection utf-8 @ point correct characters in database
  3. i changed read/write functions of site use utf-8 on

Comments