I have a simple sql query, in a joomla php server, rs forms pro. The result contains Greek characters. However, the result is displayed in question marks.

$sql = "SELECT `FieldValue` FROM `table` where `FieldName` = 'age' and `SubmissionId` =   ".$submissionId."

$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) 

{ echo
     $row["FieldValue"] ; 


??? 20 ???? (question marks should be Greek letters)

I tried using convert as utf8, and it did not work. Likewise with

 header('Content-type: text/plain; charset=utf-8');
header('Content-Type: charset=utf-8');
mysqli_set_charset($con, 'utf8mb4');

They did not work either. What else can i do?

 $sql = "SELECT CONVERT(`FieldValue` USING utf8) as `FieldValue`
  FROM `table` where `FieldName` = 'age' and `SubmissionId` =   ".$submissionId."";
  • At StackOverflow, this is where we send everybody with this issue: UTF-8 all the way through. If the tips in that page do not help you, please provide more of the details around your database table structure/settings as well as some sample data, so that we can replicate the issue. If you manage to solve your own issue, please post your solution in a fashion that future researchers will be educated by and award your post with the big green tick to signify that your issue is resolved. May 26, 2018 at 12:59
  • There is a difference between mysql_ and mysqli_` functions. Don't mix them in your script. Jun 11, 2018 at 11:31

1 Answer 1


Try doing below stuff if you are using mysql:

after you connect to the mysql, do this query to make sure that you are using UTF8:

mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET 'utf8'");

Also make sure you are using right encoding in your html head

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

If this does not work you can try different character sets for the same. This link might help you, Also one suggestion Use Joomla's methods for query building.

  • I have tried mysql_query("SET NAMES 'utf8'"); mysql_query("SET CHARACTER SET 'utf8'"); It is because of the server, not the query. Furthermore, it is a directory inside rs form, in a switch statement-i cannot use html.
    – C Java
    Apr 19, 2018 at 10:18
  • So did you changed server configs ?? Is it working now ? Apr 19, 2018 at 10:22
  • No. There is no option for utf8 in the profiles in configuration files, and not working yet.
    – C Java
    Apr 19, 2018 at 10:35
  • Did you tried to run same query in phpmyadmin ? As while I had same issue I tried above answer and it worked for me. Just to be on same page , When you say profiles configuration file what do you mean ?. Can you put some sample data on which you are not able to run the query ? Apr 19, 2018 at 10:43
  • 1
    Phpmyadmin shows greek leters normally. Pro files, it is a component that shows the folders with configuration files.
    – C Java
    Apr 19, 2018 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.