0

I have a php script that gets data from an SQL Server database. I have greek characters in that database and in order to be displayed correctly i have to do this:

     function m($s){
        return mb_convert_encoding($s,"UTF-8","ISO-8859-7");
    }

echo m($row['name']);

in each string that i get from the database.

Is there a way to enforce UTF-8 conversion for any string in the script, without using a function?

mike_x_
  • 1,900
  • 3
  • 35
  • 69

1 Answers1

0

I had to set charset for sql server connection like this:

This:

$connectionInfo = array( "Database"=>"myDB", "UID"=>"myuser", "PWD"=>"mypass","CharacterSet" => "UTF-8");

instead of this:

$connectionInfo = array( "Database"=>"myDB", "UID"=>"myuser", "PWD"=>"mypass");
mike_x_
  • 1,900
  • 3
  • 35
  • 69