Page 1 of 1

Stripping Emojis

Posted: Sun Jan 13, 2019 10:34 pm
by richmond62
This is, largely, aimed at Stephen MacLean . . .
-
Screenshot 2019-01-13 at 23.31.23.png

Code: Select all

on mouseUp
   put empty into fld "f2"
   repeat until char 1 of fld "f1" is empty
   put codePointToNum(char 1 of fld "f1") into NUMMER
   if NUMMER > 128511 then
         --do nix
      else
         put numToCodePoint(NUMMER) after fld "f2"
      end if
      delete char 1 of fld "f1"
   end repeat
   send "mouseUp" to btn "Populate"
end mouseUp

Re: Stripping Emojis

Posted: Mon Jan 14, 2019 12:27 am
by scott_morrow
Hello Richmond. I've been fooling about with your emoji stripping stack. I have found that emojis cause the <open printing to pdf> command to fail silently. Being able to strip emojis would be helpful for that as well.
Using codePointToNum(tEmojiChar) > 128511 doesn't seem to catch all the emoji characters...
this cat head < 🐱 > returns "128049"

Also some emojis now have multiple skin colors < 🧜‍♂️🧜🏾‍♂️ >and that seems to throw a monkeywrench into the works, too. When I view this post in a browser, I see that the second merman is followed by a <brown swatch> and then a <male sign>. However, the second merman I pasted was actually slightly browner than the first (and looked correct when it was originally pasted) but does not seem to pass through the posting mechanism correctly. The brown swatch and male symbol seem to be incorrectly parsed away from the second merman.

Re: Stripping Emojis

Posted: Mon Jan 14, 2019 2:39 am
by MadManSoft
Hi Richmond,

Thanks for posting this!

There are multiple ranges for emojis, as more were added in each version on Unicode.

Here is the list for the latest version of unicode 12.0

https://www.unicode.org/Public/emoji/12 ... i-data.txt

I think that between your stripper and updated unicode map, it should be able to find and strip them all?

Re: Stripping Emojis

Posted: Mon Jan 14, 2019 9:25 am
by richmond62
I guess I'm a terrible snob, but I cannot understand why the Unicode consortium
are dragging themselves through the mud with their Emoji Obsession when they
should be concerning themselves with writing systems.

Re: Stripping Emojis

Posted: Mon Jan 14, 2019 7:53 pm
by SparkOut
richmond62 wrote:
Mon Jan 14, 2019 9:25 am
I guess I'm a terrible snob, but I cannot understand why the Unicode consortium
are dragging themselves through the mud with their Emoji Obsession when they
should be concerning themselves with writing systems.
absolutely exactly definitely completely utterly the thing

Re: Stripping Emojis

Posted: Wed Jan 16, 2019 9:58 am
by richmond62
On a slightly tangential note:

This:

Code: Select all

if NUMMER > 128511 then
is just fine,
but this:

Code: Select all

if NUMMER > 128511 and < 130000 then
throws a "bluey".

Can anyone teach me some basic Logic?

Re: Stripping Emojis

Posted: Wed Jan 16, 2019 12:13 pm
by SparkOut

Code: Select all

if NUMMER > 128511 and NUMMER < 130000 then 
It might be easier to visualise if each case to resolve as true/false is parenthesised so you can see what the operator is comparing

Code: Select all

if (NUMMER > 128511) and (NUMMER < 130000) then

Re: Stripping Emojis

Posted: Wed Jan 16, 2019 12:24 pm
by richmond62
For those of you who have got nothing better to do with your time:

http://www.emojitracker.com/
-
Screenshot 2019-01-16 at 13.22.28.png

Re: Stripping Emojis

Posted: Wed Jan 16, 2019 12:25 pm
by richmond62
Livecode can do this far far more easily than:

https://java.wekeepcoding.com/article/2 ... m+a+string

Re: Stripping Emojis

Posted: Wed Nov 17, 2021 7:40 am
by scott_morrow
A while back I ended up creating a library that can not only strip emojis but can optionally replace them in the text with an imageSource. I needed this because of bug 22982 --> PDF creation on mobile fails if the text being rendered contains an emoji. While the imageSource doesn't always display on Android (I haven't figured out why) this solution at least strips out the emojis and allows the PDF to be created more or less as expected. (It even prints nicely.) The method uses comparison against a fixed string of "known" codepoints that comprise the "base" of all emojis currently in use. This library, emojiSwapLib, is MIT license and available here: https://www.elementarysoftware.com/live ... aplib.html

Re: Stripping Emojis

Posted: Wed Nov 17, 2021 8:53 am
by stam
scott_morrow wrote:
Wed Nov 17, 2021 7:40 am
. This library, emojiSwapLib, is MIT license and available here: https://www.elementarysoftware.com/live ... aplib.html
Very nice, thanks for sharing! Will definitely check this out and have use of this (although thankfully the use of emojis is very limited amongst my users!)