Page 1 of 1

encoding (or avoiding) emoji

Posted: Tue Jan 26, 2016 11:45 pm
by joel.epsteinBUS31vi
Hi all -

I'm just about to wrap up my first iOS app that uses SQLite. I dunno why I hadn't used it for data storage in the past - it's great.

But I've got a small problem and would appreciate some advice.

My app requires the user to enter lots of data. While doing initial testing, I found that everything was working just as I had hoped. Then, I tested on the simulator and realized that users have the option to enter emoji. While that's all good and fine, the problem is that I don't know how (or even if i can) encode these special characters into my SQLite database.

One option would be to figure out how to do just that. I'd be grateful for any thoughts on that path.

Alternately, I would be just as happy if I were able to figure out a way to prevent users from entering emoji in the first place. I played around with setting different keyboard types, but every one that has regular alphanumerics also seems to also have the ability to shift over to emojis. Any thoughts on alternative methods of blocking these cute but pesky characters.

Thanks so much.

Joel

Re: encoding (or avoiding) emoji

Posted: Wed Jan 27, 2016 4:14 am
by joel.epsteinBUS31vi
Okay, I'm making some progress. I've figured this much out:

Code: Select all

on inputTextChanged
   put "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz `1234567890-=[]\;',./~!@#$%^&*()_+{}|:<>?" & quote & return into tTest
   if not (tTest contains the last character of mobileControlGet("iText", "text"))   then 
      put mobileControlGet("iText", "text")  into  tText
      delete the last character of tText
      mobileControlSet "iText", "text", tText
   end if
end inputTextChanged
that works great for my native fields.

Is there a way I can do something similar for the "ask" dialog box?

Thanks.

Joel

Re: encoding (or avoiding) emoji

Posted: Wed Jan 27, 2016 6:48 am
by Simon
Hi Joel,
For normal images I just base64encode them before shoving them in a DB. There is some sort of "b*" for binary files but I've never used it.
Not sure about emoji's.

Simon