Jump to content

Ascii 129: � Instead Of '


son

Recommended Posts

Still working on my latest project I really struggle to find a solution for the ' character. Uploaded from webform it stores the character as '’' in db and displayes ASCII 129 (question mark in box) instead. Looking into str_replace, but could not get anything working yet. Any hints for this special character appreciated...Maybe important: For UTF8 the encoding for the single quotation character is E2 80 99. For Windows 1252 systems it differs. It is as:E2 is â80 is € 99 is ™For UTF8 the encoding for the single quotation character is E2 80 99.Can I make sure that data is entered with UTF8 or what would be the best bet?Thanks,Son

Link to comment
Share on other sites

there is a difference between a single quote (apostrophe): 'and a right single quatation mark: ’this 2nd one in utf8 is E2 80 99so i think the problem is that the keyboard enters a quotation mark instead of a normal apostrophei think you could solve it by replacing these where u input the data into the database, and you might also want to replace the left single quation mark (E2 80 98), by using str_replace(array("\xE2\x80\x99","\xE2\x80\x98"),'\'',$str) or something similar

Link to comment
Share on other sites

there is a difference between a single quote (apostrophe): 'and a right single quatation mark: ’this 2nd one in utf8 is E2 80 99so i think the problem is that the keyboard enters a quotation mark instead of a normal apostrophei think you could solve it by replacing these where u input the data into the database, and you might also want to replace the left single quation mark (E2 80 98), by using str_replace(array("\xE2\x80\x99","\xE2\x80\x98"),'\'',$str) or something similar
Thanks Wander,Have tried to use:$t = str_replace(array("\xE2\x80\x99","\xE2\x80\x98"),'\'',$_POST['pageText']);which is then inserted in db. As long as problematic character is not entered this works, but as soon as problematic character is part of text my insert fails (else clause of if ($result2 = mysqli_query ($dbc, $query2)) comes in). The server log file does not show any useful data. A var dump shows the entered string correcly (even with single quotation mark). Why could this be?Son
Link to comment
Share on other sites

Wander,Have it working now with:

	$t = str_replace(array("\xE2\x80\x99","\xE2\x80\x98"),'\'',$_POST['pageText']);	$t = escape_data($t);

Thanks for your help. Would not have managed to find solution without your help:-)SonActually, just one more question: On display page (where data gets fetched from db) I have:$order0 = array('“', '”', '–', '’');$replace0 = array('"', '"', '-', '\'');$webSafe = str_replace($order0, $replace0, $str);For those records I entered before I would have thought this would deal with those. It doesn't. So I have to go back to all records and change?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...