title: Convert arrays into UTF-8 ? PHP JSON
body: <p>i have multidimensional arrays generated by PHP with data from database ,but i have chars like "č ć š đ ž" and when i try to output that in json he just returns null , i did some reading about that ,and it says that JSON is only working with UTF-8. So how can i convert those arrays in UTF-8 ? but i still need arrays at the and?</p>
  
  <p>here is code of my script </p>
  
  <pre><code>     $sql_main = mysql_connect(DB_HOST, DB_UNM, DB_PSW);
      ($sql_main)? mysql_select_db(DB_NM) : mysql_error();
  
      $APP_URL_ACCESS = $_GET['app_access_key'];
  
      $sql_app = mysql_query("SELECT * FROM app_sys WHERE APP_OW_C='$APP_URL_ACCESS'") or die(mysql_error());
  
      if(mysql_num_rows($sql_app)==1){
  
          while($row = mysql_fetch_array($sql_app)){
          $APP_UA_ID          = $row['APP_UA_ID'];
          $APP_NM             = $row['APP_NM'];
          $APP_H_DMN          = $row['APP_H_DMN'];
          $APP_H              = $row['APP_H'];
          $APP_H_DB_UNM       = $row['APP_H_DB_UNM'];
          $APP_DB_NM          = $row['APP_DB_NM'];
          $APP_H_DB_PSW       = $row['APP_H_DB_PSW'];
          $APP_H_DB_SRV       = $row['APP_H_DB_SRV'];
          $APP_ACTIVE         = $row['APP_ACTIVE'];
          $APP_OW_C           = $row['APP_OW_C'];
  
  
      }
      $ROW_APP[] = array(
                          'APP_UA_ID' =&gt; $APP_UA_ID,
                          'APP_PERMISSION' =&gt; $APP_ACTIVE,
                          'APP_KEY' =&gt; $APP_OW_C);
      $APP_ARRAY[''] = $ROW_APP;
  
  
  
      ($APP_ACTIVE == '1')? $sql_connect_app = mysql_connect($APP_H_DB_SRV, $APP_H_DB_UNM, $APP_H_DB_PSW) &amp;&amp; mysql_select_db($APP_DB_NM): $_MSG = "Application Is Not Active"; 
  
      $sql_news = mysql_query("SELECT * FROM news  ORDER BY id DESC LIMIT 10") or die(mysql_error());
      while($row = mysql_fetch_array($sql_news, MYSQL_ASSOC)){
              //$display_json['data'] = array(
                  //'id' =&gt; $row['id'],
      //          'title' =&gt; $row['title'],
          //      'story' =&gt; $row['story'],
          //      'img' =&gt; $row['img'],
              //  'author' =&gt; $row['author'],
                  //'datetime' =&gt; $row['datetime'],
                  //'shorten_story' =&gt; substr($row['story'], 0, 150) . '...'); */
  
              $ROW_APP_DATA[] = $row; 
      //
  
  }
  
  $sql_news = mysql_query("SELECT * FROM actual  ORDER BY id DESC LIMIT 10") or die(mysql_error());
  while($row = mysql_fetch_array($sql_news, MYSQL_ASSOC)){
          /*$display_json['data'] = array(
              'id' =&gt; $row['id'],
              'title' =&gt; $row['title'],
              'story' =&gt; $row['story'],
              'img' =&gt; $row['img'],
              'author' =&gt; $row['author'],
              'datetime' =&gt; $row['datetime'],
              'shorten_story' =&gt; substr($row['story'], 0, 150) . '...'); */
              $ROW_APP_THIRDPART[] = $row;    
      //
  
  }
  
  $JSON_ARRAY_APP['application'] = $ROW_APP;
  $JSON_ARRAY_DATA_1['news'] = $ROW_APP_DATA;
  $JSON_ARRAY_DATA_2['actual'] = $ROW_APP_THIRDPART;
  $JSON_ARRAY_DATA['data'] = array_merge($JSON_ARRAY_DATA_1, $JSON_ARRAY_DATA_2);
  $JSON_OUTPUT = array_merge($JSON_ARRAY_APP, $JSON_ARRAY_DATA);
  echo json_encode($JSON_OUTPUT);
  
  }else{
  exit(); 
  }
  </code></pre>