I got from my server long string while part of it is emoji's as unicode text:
I'm using angular 5. not native JS.
"Hello hello \ud83c\udfdb"
The server return the data OK. If I print it as is, the browser is displaying all the emoji's correctly.
In my code I need to print every of my characters as different span
tag
For doing that I go over the whole string and print it char by char:
<span id="col_1">H</span>
<span id="col_2">e</span>
<span id="col_3">l</span>
.
.
.
<span id="col_13">�</span>
What I figure out is that some of the emoji are 2 chars (instead of one - what I thought).
For instance: �� =
How can I get from long string char by char including emoji's?
I'm using binding with *ngFor {{character}}
Update 1
When I said char by char:
for (let j = 0; j < currentSentence.length; j++) { // Loop on all chars
const char = currentSentence[j];
this.sentencesSplitter[i] = char;
}
And then in my HTML file:
<span *ngFor='let character of sentencesSplitter; let j = index'>{{character}}</span>