• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Representation of strings with special chars
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Representation of strings with special chars


  • Subject: Re: Representation of strings with special chars
  • From: Alexander Reichstadt <email@hidden>
  • Date: Thu, 25 Aug 2011 23:03:30 +0200

Hi,

Thank you for your many responses.

>    const char *cstr = [s UTF8String];
>    mysql_stmt_prepare(myStatement, cstr, strlen(cstr));


This fixed the bug.

Alexander


Am 24.08.2011 um 22:37 schrieb Greg Parker:

> On Aug 24, 2011, at 1:24 PM, Alexander Reichstadt wrote:
>> Actually it's a couple of wrapper-classes to MYSQL c-calls by Karl Kraft.
>>
>> In the sqlfetch-class, eventually it arrives at....
>>
>> mysql_stmt_prepare(myStatement, [s UTF8String],[s length])
>>
>> where s is the NSString instance containing the SELECT-statement, such as SELECT field="someÜberthing".
>>
>> From there it goes on to....
>>
>> int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
>>                              unsigned long length);
>>
>> ....and at this point it fails.
>
> First, [s length] is the wrong value to pass as the length of [s UTF8String]. Try this instead:
>    const char *cstr = [s UTF8String];
>    mysql_stmt_prepare(myStatement, cstr, strlen(cstr));
>
> Second, this code is sending UTF-8 encoded character data to MySQL. Make sure that your MySQL environment is configured to accept UTF-8 data.
>    http://rentzsch.tumblr.com/post/9133498042/howto-use-utf-8-throughout-your-web-stack
> If your MySQL system instead expects some other encoding like ISO Latin-1, you can tell NSString to output that instead.
>    [myString cStringUsingEncoding:NSISOLatin1StringEncoding];
>
>
> --
> Greg Parker     email@hidden     Runtime Wrangler
>
>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Representation of strings with special chars
      • From: "Glenn L. Austin" <email@hidden>
References: 
 >Representation of strings with special chars (From: Alexander Reichstadt <email@hidden>)
 >Re: Representation of strings with special chars (From: Sean McBride <email@hidden>)
 >Re: Representation of strings with special chars (From: Alexander Reichstadt <email@hidden>)
 >Re: Representation of strings with special chars (From: Greg Parker <email@hidden>)

  • Prev by Date: Re: Sharing a persistent store between iOS and Mac
  • Next by Date: Re: "iTunes Music Library.xml" won't load with dictionaryWithContentsOfFile:
  • Previous by thread: Re: Representation of strings with special chars
  • Next by thread: Re: Representation of strings with special chars
  • Index(es):
    • Date
    • Thread