encoding (or avoiding) emoji

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
joel.epsteinBUS31vi
Posts: 135
Joined: Thu Sep 13, 2012 10:25 pm

encoding (or avoiding) emoji

Post by joel.epsteinBUS31vi » Tue Jan 26, 2016 11:45 pm

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

joel.epsteinBUS31vi
Posts: 135
Joined: Thu Sep 13, 2012 10:25 pm

Re: encoding (or avoiding) emoji

Post by joel.epsteinBUS31vi » Wed Jan 27, 2016 4:14 am

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: encoding (or avoiding) emoji

Post by Simon » Wed Jan 27, 2016 6:48 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply