jellyfin / jellyfin-plugin-webhook

GNU General Public License v3.0
142 stars 45 forks source link

telegram bot / unicode to utf-8 fails for german umlate Ü Ö Ä #127

Open Schrebergarten03-links opened 2 years ago

Schrebergarten03-links commented 2 years ago

Hi thx for this plugin.

So i have made a telegram bot posting new additions to a telegram channel.

{ "chat_id": -privatenumber, "text": "{{{SeriesName}}} {{SeasonNumber00}} {{EpisodeNumber00}} {{{Name}}} ({{Year}})

{{Overview}} " "disable_notification":"true", "protect_content":"true" }

the german letters üÜ öÖ äÄ and ß dont get encoded in utf-8

example output in telegram : Für Fritz, "Rollo", "GeGe" und ihre freunde ein Spiel ums Überleben.

Can i enforce the right encode this anyway in the plugin or must it be fixed in code ?

ghost commented 1 year ago

I have the similar error, but in my case this is the request:

Jellyfin.Plugin.Webhook.Destinations.Generic.GenericClient: Notification failed with "POST" request to https://api.telegram.org/bot(my bot API)/sendMessage: "{
\"chat_id\":\"(my chat id)\",
\"text\": \"Adaś now active\n\",
\"parse_mode\": \"markdownv2\",
\"disable_notification\": \"true\",
\"protect_content\": \"true\"
}"

and Telegram API responds with Bad Request and tells me to escape the # character:

Jellyfin.Plugin.Webhook.Destinations.Generic.GenericClient: Notification failed with response status code BadRequest: "{\"ok\":false,\"error_code\":400,\"description\":\"Bad Request: can't parse entities: Character '#' is reserved and must be escaped with the preceding '\\'\"}"

This is definitely related to european characters encoding