• 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
Application crashing due to unicode characters in string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Application crashing due to unicode characters in string


  • Subject: Application crashing due to unicode characters in string
  • From: Devarshi Kulshreshtha <email@hidden>
  • Date: Wed, 1 Dec 2010 19:56:41 +0530

Hi all,

I am making an application in which I have to store data from remote db into
local sqlite3 db.

Problem is - when any string to be inserted contains unicode character such
as: \U00a0 or \U2022 or \U2019, it crashes.

The part of code which crashes is this-

NSString *insertQuery = @"insert into XYZ(field1,field2) values
(@"1",[recordDict objectForKey:@"field2"]);

// recordDict contains value: @"\U00a0 \U00a0 \U00a0 \U00a0The
Cadfsdfsdfptain\U2019s" for key: @"field2"

sqlite3_stmt *insertStmnt;
const char *sql = [insertQuery cStringUsingEncoding:1];
printf("insertQuery - %s",sql); // it is showing insertQuery - (null) and
crashing at next line
if(sqlite3_prepare_v2(database, sql, -1, &insertStmnt, NULL) != SQLITE_OK){
    NSLog(@"Error while creating insert statement.
'%s'",sqlite3_errmsg(database));
}

Can anyone suggest me how to resolve this problem?

--
Thanks,

Devarshi
_______________________________________________

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: Application crashing due to unicode characters in string
      • From: "email@hidden" <email@hidden>
    • Re: Application crashing due to unicode characters in string
      • From: Scott Ribe <email@hidden>
  • Prev by Date: Re: [iOS] setting table style for root view controller of a navigation controller
  • Next by Date: Re: UIWindow orientation
  • Previous by thread: Re: [iOS] setting table style for root view controller of a navigation controller
  • Next by thread: Re: Application crashing due to unicode characters in string
  • Index(es):
    • Date
    • Thread