title: Weird charset when inserting into mdb database using php
body: <p>I have a web application I wrote using ASP.NET couple years ago, it saves form data into mdb database and then convert it to XLS file when the user chooses to.</p>
  
  <p>I changed the form handling code into php and I noticed that arabic characters are converted to a different charset.</p>
  
  <p>Example: <code>تجربة</code> will be stored as <code>ØªØ¬Ø±Ø¨Ø©</code>
  I can convert it back to arabic when pasting it in the UTF8-Encoded field using this <a href="https://mothereff.in/utf-8" rel="nofollow">online tool</a>.</p>
  
  <p>here is the code:</p>
  
  <pre><code>ini_set('default_charset', 'utf-8');
  header('Content-Type: text/html;charset=utf-8');
  $dbName = "DB\DB.mdb";
  if (!file_exists($dbName)) {
      die("Could not find database file.");
  }
  
  $connection = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$dbName", "", "");
  odbc_exec($connection , "SET NAMES 'UTF8'");
  odbc_exec($connection , "SET client_encoding='UTF-8'");
  
  $stmt="INSERT INTO arabic_table (val) VALUES('".$_POST["arabicTxT"]."')"; 
  $resultset=odbc_exec($connection,$stmt);
  </code></pre>
  
  <p>Please note:
  I converted all files to utf-8 using notepad.
  I tested the arabic inputs by 'echo'ing them back before storing them, and they are in the correct charset.
  ASP does store arabic characters perfectly.
  I do not have any PDO drivers in my shared hosting.</p>
  
  <p>I have searched a solution for hours with no luck, any ideas?</p>
  
  <p>Thanks in advance.</p>