Jump to content

alamb

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by alamb

  1. Follow-up... I'm guessing at this point that it must have something to do with how the data has been encoded in the database. Even though I have changed the db 'collation' field to be unicode, there must be something else that is necessary when I "INSERT" the data. I have also added a "SET NAMES utf8" after connection, but that doesn't seem to fix it either. Anyone know what I'm missing here? Any other ideas?
  2. Sorry, that output above was not right - I would have been happy with that. I must have fat fingered the copy/paste. The output now is: Real Case It s
  3. No, that did not fix it but it did change the boxes into spaces. Output now: Real Case Its I changed: $qtext = $row['text']; to be: $qtext = utf8_encode($row['text']);
  4. Hello, I am very confused as to why when I try to change my charset="UTF-8" from "ISO-8859-1" I now get box characters displayed where I used to have curly quotes and dashes in the text coming out of a MySQL database. I had originally used the default db varchar setting "latin1_swedish_ci" and have since changed that to be "utf8_unicode_ci" for this particular 'text' field. I have stripped my code down to the following for your consideration. The output from this is where the ? marks appear as boxes in my browser: Real Case � It�s I should look this and does when I change back to charset="ISO-8859-1": Real Case – It’s Here is my PHP code. Thanks in advance for your help. <?php // session start must happen before any other output session_start(); // debug only ini_set('display_errors',1); //ISO-8859-1 header("Content-type: text/html; charset=UTF-8"); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title> </head> <?php ## secret password file ## include("tempars.inc"); // globals $query = ""; $qtext = ""; $mID = "abc 123"; $qID = "7"; // global connection ($cxn) to get current question ($qID) $cxn = mysql_pconnect($host,$user,$password); mysql_select_db($dbname); $query = "SELECT * FROM question WHERE mID='$mID' AND qID='$qID'"; $result = mysql_query($query); if($result == false) { echo "<h4>SELECT Error: ".mysql_error($cxn)."</h4>"; } elseif(@mysql_num_rows($result) == 1) { $row = mysql_fetch_assoc($result); $qtext = $row['text']; } echo "<body >"; echo "$qtext"; mysql_close($cxn); echo "</body></html>"; // end of the program ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.