PoshBot icon indicating copy to clipboard operation
PoshBot copied to clipboard

Writing emojis to Discord backend converts to ascii

Open Szeraax opened this issue 4 years ago • 1 comments

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

  • Module version used: latest
  • Operating System and PowerShell version: Posh 7.1 on windows 10

Szeraax avatar Nov 08 '21 18:11 Szeraax

@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

devblackops avatar Nov 10 '21 06:11 devblackops