note 106653 deleted from function.str-replace by googleguy

From: Date: Wed, 23 Oct 2013 00:24:04 +0000
Subject: note 106653 deleted from function.str-replace by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197297@lists.php.net to get a copy of this message
Note Submitter: windowshater ---- I hope this helps someone who has gone insane for 4 hours... If you have someone posting weird windows curly quotes into your forms and you cannot replace them using str_replace. I tried using mb_convert_encoding to convert the string to UTF-8 and then to do a str_replace but still no joy. I tried to str_replace using the \xe2\x80\x98 codes and also using the chr(145), chr(146), chr(147) codes. Nothing worked... It would replace the quotes but then ADD a question mark in a diamond !!!! no idea why.. in the end i just url encoded the string and replaced teh html codes: $search_weird_chars = array( '%E2%80%99', '%E2%80%99', '%E2%80%98', '%E2%80%9C', '%E2%80%9D' ); $this->post_array[$key] = urlencode($this->post_array[$key]); $this->post_array[$key] = str_replace($search_weird_chars, "'", $this->post_array[$key]); $this->post_array[$key] = urldecode($this->post_array[$key]); this works although it is a totally retarded thing to have to do .. oh well. :-)

« previous php.notes (#197297) next »