From 8884aa75535482332e465bde17de77679a92d8df Mon Sep 17 00:00:00 2001 From: Ned Holbrook Date: Mon, 19 Aug 2024 17:37:46 -0700 Subject: [PATCH] Add variation selectors to emoji alt properties (#700) --- .../unicode/tools/emoji/GenerateEmoji.java | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/unicodetools/src/main/java/org/unicode/tools/emoji/GenerateEmoji.java b/unicodetools/src/main/java/org/unicode/tools/emoji/GenerateEmoji.java index 1237daf7e9..074629a236 100644 --- a/unicodetools/src/main/java/org/unicode/tools/emoji/GenerateEmoji.java +++ b/unicodetools/src/main/java/org/unicode/tools/emoji/GenerateEmoji.java @@ -18,6 +18,7 @@ import com.ibm.icu.lang.UCharacter; import com.ibm.icu.text.Collator; import com.ibm.icu.text.Transform; +import com.ibm.icu.text.Transliterator; import com.ibm.icu.text.UTF16; import com.ibm.icu.text.UnicodeSet; import com.ibm.icu.text.UnicodeSet.EntryRange; @@ -544,6 +545,8 @@ private static String getSvgImage( return null; } + static final Transliterator TO_HEX = Transliterator.getInstance("Any-Hex/XML"); + /* * Note that Emoji.BESTOVERRIDE can override the source type for specific * characters. @@ -597,8 +600,9 @@ public static String getImage( type, filename, doFlip) : "../images/" + filename; } + String escaped = TO_HEX.transliterate(chars); return ""
-                    + chars
+                    + escaped
                     + "" + linkPre - + getBestImage(core, true, "", Emoji.Source.SAMPLE_SOURCE) + + getBestImage(s, true, "", Emoji.Source.SAMPLE_SOURCE) + linkPost + "\n"; } @@ -3748,6 +3755,7 @@ public static String getCell( fullName = EmojiImageData.getDataUrlFromFilename(type, filename); } if (fullName != null) { + String escaped = TO_HEX.transliterate(s); String className = type.getClassAttribute(core); androidCell = "" + linkPre + "