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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to