1

This is my php file :

<?php
  define('HOST','localhost');
  define('USER','myUser');
  define('PASS','myPass');
  define('DB','myDb');
  $con = mysqli_connect(HOST,USER,PASS,DB);
  $text = $_POST['text'];
  $name = $_POST['name'];
  $subject = $_POST['subject'];
  mysqli_set_charset($con,"utf8");
  $sql = "insert into someTable (email,text,name,subject) values ('$email','$text','$name','$subject')";
  if(mysqli_query($con,$sql)){
     echo 'Sent successfully';
  }
  else{
     echo 'Unexpected error';
  }
  mysqli_close($con);
?>

I'm sending some values from my android app to this php backend and this code will save my values to MySQL database.

It's working perfect but if i send values in non english language it shows values like this: enter image description here

I've already set MySQL collation on UTF-8 and I think the problem is from my php backend

EDIT:

I also tried solutions in this topic but it's not working.

Mahdi Nouri
  • 1,391
  • 14
  • 29

1 Answers1

3

You had to set the collection to utf8Persian-ci. Of course I also had a problem like yours, please refer to this Link, I hope that can help you :)

no id
  • 1,642
  • 3
  • 24
  • 36
Azade
  • 359
  • 2
  • 15