title: Cannot properly insert greek characters in mysql database
body: <p>Our mysql database shows <code>Î Î¿Î»Ï Î³Î»Ï…ÎºÏŒÏ</code> in place of greek characters while sending data from an emulator to a mysql database. Other characters are left ok.</p>
  
  <p>screenshot from phpMyAdmin:</p>
  
  <p><a href="https://i.stack.imgur.com/fe28C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fe28C.png" alt="data"></a></p>
  
  <p>UPDATE:</p>
  
  <p>After using </p>
  
  <p>@Félix Gagnon-Grenier answer in my code it gives me this:</p>
  
  <p><a href="https://i.stack.imgur.com/R4kp6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R4kp6.png" alt="Database"></a></p>
  
  <p>Sql for table creation</p>
  
  <pre><code>CREATE TABLE `cart` (
   `id` bigint(20) NOT NULL AUTO_INCREMENT,
   `product_name` varchar(255) NOT NULL,
   `product_price` double(3,2) NOT NULL,
   `product_image` varchar(255) NOT NULL,
   `quantity` int(11) NOT NULL,
   `preferation1` varchar(50) NOT NULL,
   `preferation2` varchar(50) NOT NULL,
   `preferation3` varchar(50) NOT NULL,
   `preferation4` varchar(50) NOT NULL,
   `magazi_id` int(11) NOT NULL,
   `servitoros_id` int(11) NOT NULL,
   PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/YGELV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YGELV.png" alt="enter image description here"></a></p>
  
  <p>php</p>
  
  <pre><code>&lt;?php
      error_reporting(E_ALL ^ E_NOTICE);
      ini_set("default_charset", "UTF-8");
      header('Content-type: text/html; charset=UTF-8');
      mb_internal_encoding('UTF-8');
      mb_http_input("utf-8");
      try {
          $handler = new PDO('mysql:host=localhost;dbname=database', 'username', 'password');
          $handler-&gt;setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8' COLLATE 'utf8_general_ci' ");
          $handler-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      } catch (Exception $e) {
          echo $e-&gt;getMessage();
          die();
      }
  
      $productName = $_POST['productName'];
      $productPrice=$_POST['productPrice'];
      $productImage = $_POST['productImage'];
      $quantity = $_POST['quantity'];
      $sugar = $_POST['sugar'];
      $milk = $_POST['milk'];
      $flavor=$_POST['flavor'];
      $comment = $_POST['comment'];
      $magazi = $_POST['magazi_id'];
      $servitoros = $_POST['servitoros_id'];
  
      $handler-&gt;query("INSERT INTO cart(id, product_name, product_price, product_image, quantity, preferation1, preferation2, preferation3, preferation4, magazi_id, servitoros_id) VALUES('', '$productName','$productPrice','$productImage', '$quantity', '$sugar', '$milk', '$flavor', '$comment', '$magazi', '$servitoros')");
      die();
  ?&gt;
  </code></pre>
  
  <p>Java</p>
  
  <pre><code>protected Void doInBackground(String... params) {
              nameValuePairs = new ArrayList&lt;&gt;();
              nameValuePairs.add(new BasicNameValuePair("productName", productName));
              nameValuePairs.add(new BasicNameValuePair("productPrice", String.valueOf(price)));
              nameValuePairs.add(new BasicNameValuePair("productImage", image));
              nameValuePairs.add(new BasicNameValuePair("quantity", String.valueOf(quantityNumberFinal)));
              nameValuePairs.add(new BasicNameValuePair("sugar", sugarPreference));
              nameValuePairs.add(new BasicNameValuePair("milk", milkPreference));
              nameValuePairs.add(new BasicNameValuePair("flavor", flavorPreference));
              nameValuePairs.add(new BasicNameValuePair("comment", comment));
              nameValuePairs.add(new BasicNameValuePair("magazi_id", String.valueOf(2)));
              nameValuePairs.add(new BasicNameValuePair("servitoros_id", String.valueOf(13)));
              try
              {
                  HttpParams httpParams = new BasicHttpParams();
                  HttpProtocolParams.setContentCharset(httpParams, "UTF-8");
                  httpClient = new DefaultHttpClient(httpParams);
                  httpPost = new HttpPost(params[0]);
                  httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
                  response = httpClient.execute(httpPost);
                  httpEntity = response.getEntity();
                  is = httpEntity.getContent();
              }
              catch(Exception e)
              {
                  Log.e("Fail 1", e.toString());
              }
              return null;
          }
  </code></pre>