Hey all:

Do you have any idea how I can display this Unicode character U+1F601 
<https://apps.timwhitlock.info/unicode/inspect/hex/1F601> or these UTF-8 Bytes 
\xF0\x9F\x98\x81 using TLF (in RichEdit control)?

Thanks!

Erik

For additional background on my problem, read on...

I'm implementing a mobile social media feed display using TLF (spark RichText) 
to display inline emoji. The user enters a short message into a TextInput 
control on the phone, and using the soft keyboard selects emoji keyboard, 
selects an emoji to display with the text and posts their update.

Getting the text from the user works fine and the emoji is represented as UTF 
or Unicode value though I don't know how to verify.

The TextInput control on the device shows the emoji rendering perfectly (spark 
TextInput):



The value in the IntelliJ debugger's Variables view also renders the Unicode or 
UTF bytes correctly:



But when I attempt to set the contents of the RichText control with the 
contents of the input field, the emoji is lost:



I have tried many approaches, some are:
var value:String = textInput.text; // this contains the emoji:
richEditControl.text = value;

richEditControl.textFlow = TextFlowUtil.importFromString(value);

richEditControl.textFlow = TextConverter.importToFlow(value, 
TextConverter.TEXT_FIELD_HTML_FORMAT);

richEditControl.textFlow = TextConverter.importToFlow(value, 
TextConverter.PLAIN_TEXT_FORMAT);
They each fail to display the emoji. I can display complex content in the same 
control no problem and I'm pretty familiar with TLF:



I want to deal with HTML markup and TextConverter rather than composing the TLF 
in code, but if I have to go that route, I'm willing to if it works.

But getting the RichText control's TextFlow to display a UNICODE character is a 
mystery to me and googling for answers has not been fruitful.

I understand there is some question of whether Android phones will display the 
equivalent emoji as on iPhone, I get that. But looking at this chart, it should 
be possible for the most part:

https://apps.timwhitlock.info/emoji/tables/unicode 
<https://apps.timwhitlock.info/emoji/tables/unicode>

My problem should be a simple as just learning how to display this Unicode 
character U+1F601 <https://apps.timwhitlock.info/unicode/inspect/hex/1F601> or 
these UTF-8 Bytes \xF0\x9F\x98\x81 using TLF. Is it possible? Thanks! Erik


Reply via email to