-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[String] Add a method to stripg emojis from strings #58003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Stripping emojis from a string is already supported by the EmojiTransliterator: use Symfony\Component\Emoji\EmojiTransliterator;
$emojiStrippingTransliterator = EmojiTransliterator::create('emoji-strip');
$string = 'my input string which may have emojis';
$stringWithoutEmoji = $emojiStrippingTransliterator->transliterate($string); So this can be done even if |
And btw, the same question applies for this use case than for previous ones: is the issue in the third-party services related to not accepting emojis or is it about not accepting multi-bytes UTF-8 codepoints (maybe only the ones using 4 bytes) ? |
I'm not certain about it. They are not that explicit |
@MolloKhan the question is what do they reject (and why). See for instance #48853 (comment): the broken utf8 type in MySQL (which uses Rejecting only emojis is actually much more explicit than rejecting 4-bytes codepoints. |
Yea, but they don't say. The API call just fails with "invalid data". I discovered that removing all emojis fixes the issue. Anyway, I was not aware that the Symfony Emoji component already has this feature, so if you don't find a real value add a shortcut to it in the String component, I think we can close this request |
Well, both issues you linked were saying that they leverage the EmojiTransliterator to implement the stripping. I will close this issue as I don't think the use case mentioned here is sufficient to revisit our decision to reject the shortcut in the String component. |
Description
Following up on #48853 and #48850 here's another use case that may help to push this feature forward.
In SymfonyCasts, we use a third-party service to generate video captions. It requires sending the script file which may contain emojis and that causes trouble. So, I need to remove them before sending the file to the third-party service
Example
No response
The text was updated successfully, but these errors were encountered: