mysql - PHP 5.5 with html_entity_decode and IIS8 -


we moved iis 7.5 php 5.3.4 iis 8 php 5.5. having issues data pulled mysql. issue not present on previous infrastructure.

when string pulled mysql , displayed client encoding not displaying properly.

ex:

text should display , on old infrastructure:

"¿qué planearon sandra y carlos en este episodio?

but displays as:

"¿qué planearon sandra y carlos en este episodio?"php

i have tried following:

  1. add header client interprets utf-8, no change.

    header('content-type: text/html; charset=utf-8');

  2. echo encoded characters below: (they display correctly client as: ä ö ü ß €.)

    "\xc3\xa4"."\xc3\xb6"."\xc3\xbc"."\xc3\x9f"."\xe2\x82\xac";

  3. add encoding options html_entity_decode utf-8. no change.

any ideas? code blow.

<?php ini_set('display_errors',1);  error_reporting(e_all); // connect database $db_name = 'removed'; $db_host = 'removed'; $db_user = 'removed'; $db_pass = 'removed';  $mysqli = new mysqli($db_host, $db_user, $db_pass, $db_name);  if (mysqli_connect_errno()) {     printf("connect failed: %s\n", mysqli_connect_error());     exit(); }  // quick query on fake user table $query = "select * `tablename` `item`='1234'"; $result = $mysqli->query($query) or die($mysqli->error.__line__);  // going through data if($result->num_rows > 0) {     while($row = $result->fetch_assoc()) {     echo html_entity_decode($row['prompt']);         } } else {     echo 'no results';   }  // close connection mysqli_close($mysqli); 

looks database stored in latin 1 encoding , not in utf8, quick fix should use syntax:

<?php echo html_entity_decode($row['prompt'],ent_compat | ent_html401,'iso-8859-1'); 

the real fix fix database store data in utf8 , have of toolchain in utf8.

html_entity_decode() has utf8 default encoding since php 5.4: http://fr2.php.net/manual/en/migration54.other.php


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -