56
Views
10
Comments
Substr fail to copy a string with emoji
Question
Application Type
Mobile

Dear Community,

The Substr function fails whenever the string contains emojis. Has anyone found a solution for it? 

2023-06-05 15-54-04
João Correia

Hi Ron,

Please expand on how the Substr built-in function fails. What's the output?

Also, provide the parameters you're using.

UserImage.jpg
Ron Ben

The widget in which the Substr is part of the expression (assignment in my case) throw an exeption and the sting ins't copied at all.

2023-06-05 15-54-04
João Correia

Alright, again, please provide more context. Share the exception thrown and the Substr parameters if possible.

UserImage.jpg
Ron Ben

substr("❤️Outsystems👿Substr😳",1,10)  throw an exception. 

Desired result: "Outsystems"

2021-09-06 15-09-53
Dorine Boudry
 
MVP

I tried in a reactive app and i  have no problem with it.  

Can you share an oml of what exactly you are doing and see if the problem is with mobile vs reactive ?

(I can't check, not near a computer now)

UserImage.jpg
Ron Ben

I'm attaching an OAP that demonstrate the issue

Test.oap
UserImage.jpg
Ron Ben

Please see the attached OAP that demostrate the issue

Test.oap
2024-05-08 06-29-37
Prince Aadil Khan Panwar

Hi @Ron Ben 

i checked your OAP and its working fine. 

just try to do this 

attaching the oap.

Regards,

Prince

Test.oap
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Ron,

I would suggest you to read the following article. It explains in-depth what the underlying encoding of emojis is, and hence you can understand the problems with using Substr on multi-byte characters (like emojis).

UserImage.jpg
Ron Ben

I understand the issue and the differences between length in terms of chars and length in terms of bytes. My question was regsrding a way of counting/extracting the bytes of a string rather of the chars like length/substr?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.