poshbotio / PoshBot

Powershell-based bot framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Writing emojis to Discord backend converts to ascii

Szeraax opened this issue · 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:

if (-not $Params['ContentType']) {$Params['ContentType'] = 'application/json'}

with:
$Params['ContentType'] = 'application/json;charset=utf-8'

This seems similar to the Teams backend solution:

ContentType = 'application/json;charset=utf-8'

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 Thanks for the issue and the suggested fix. This should be fixed in da076e7.

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