Re: Convert Smart Quotes to Sraight Quotes - Need Help!

From: Date: Tue, 07 Sep 2004 23:14:53 +0000
Subject: Re: Convert Smart Quotes to Sraight Quotes - Need Help!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-196084@lists.php.net to get a copy of this message
Anyone! I'm out of online resources and answers. I guess this isn't possible to do... > I've been reading for the last three days about character encodings and > such, but, have still been unable to figure out what I think should be a > simple solution. > > All I want to do is take curly or "smart" quotes that have been pasted or > entered into a form field and convert those into straight quotes (") before > I store the text in my database. > > It appears the data passed from the form to my PHP script is encoded as > Unicode. My version of MySQL does not support Unicode character encoding, > so, I need to convert that into Latin1 (or ISO-8859-1). > > When I use iconv() to translate the data that contains curly quotes, the > string gets chopped off at the very first curly quote and the rest of the > string is lost. This is the command I am using: > > $var = iconv("UTF-8", "ISO-8859-1", $var); > > When I use utf8_decode(), I at least get the whole string back, but, all the > curly quotes and apostrophes are turned into ? question marks. > > So, I presume there must be some way to convert those curly quotes into > straight ASCII quotes while the text is still in Unicode format, before I > run this through either iconv() or utf8_decode(). But, I've searched all > over for two days and can't figure out how to accomplish this. > > I'd really appreciate someone's help with this! It's driving me nuts!! > > Thanks, > > Monty

« previous php.general (#196084) next »