poshbotio / PoshBot

Powershell-based bot framework
MIT License
536 stars 108 forks source link

Writing emojis to Discord backend converts to ascii #237

Open Szeraax opened 2 years ago

Szeraax commented 2 years ago

My case

I've created an example function that takes a reaction name and sends it back as text to the channel.

Desired Behavior

Emoji's output to utf-8 charset: image

Current Behavior

Any emojis in output get converted to ascii

image

Possible Solution

Replace: https://github.com/poshbotio/PoshBot/blob/ee1f8908a3a92cdc63444cf36332e958ae034640/PoshBot/Implementations/Discord/DiscordBackend.ps1#L794 with: $Params['ContentType'] = 'application/json;charset=utf-8'

This seems similar to the Teams backend solution: https://github.com/poshbotio/PoshBot/blob/ee1f8908a3a92cdc63444cf36332e958ae034640/PoshBot/Implementations/Teams/TeamsBackend.ps1#L247

Steps to Reproduce (for bugs)

Write-Output "Emoji: ❗"

Context

I am trying to have non-ascii characters get preserved when they get posted to Discord

Your Environment

devblackops commented 2 years ago

@Szeraax Thanks for the issue and the suggested fix. This should be fixed in da076e71f73e58cbbbffca87b39093f69ccd74b0.

Example:

Screen Shot 2021-11-09 at 10 54 04 PM