Re: MySQL Escaped String
Re: MySQL Escaped String
- Subject: Re: MySQL Escaped String
- From: Robin Hermann <email@hidden>
- Date: Wed, 12 Jan 2005 05:58:32 +0100
>From the MySQL reference
/*-----
This function is identical to <x-tad-bigger>mysql_real_escape_string()</x-tad-bigger> except that <x-tad-bigger>mysql_real_escape_string()</x-tad-bigger> takes a connection handler as its first argument and escapes the string according to the current character set. <x-tad-bigger>mysql_escape_string()</x-tad-bigger> does not take a connection argument and does not respect the current charset setting.
-----*/
I can't find any info which encoding is needed for mysql_escape_string.
The standard encoding on the server is ISO-8859-1 (Latin1). Right now figuring out how to get the connection handler from SMySQLConnection, or implement my own to start using the mysql_real_escape_string. Which seems to be the only right way to do it.
Robin Hermann
On 11 jan 2005, at 20:33, Will Mason wrote:
So if mysql_escape_string is expecting a standard ASCII based c
string
you may run into problems. So depending on what you are expecting
string wise consider using lossyCString instead of UTF8String since
the
former will get you an ASCII c string by dumping the character that
cannot be represented in such a type of string.
It's true that the best approach is to figure out which encoding
mysql_escape_string() is expecting, and encode the string using that.
Note that [NSString lossyCString] will only return an ASCII-encoded
string if ASCII is the default encoding for the machine running the
code, which is highly unlikely. It's much more likely that the default
encoding will be something like Latin-1 if you're in North or South
America or in Europe. ASCII is not an alias for Latin-1.
Will
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden