csgo-league / csgo-league-bot

League Discord bot
https://discord.gg/b5MhANU
GNU General Public License v3.0
14 stars 12 forks source link

Unicode characters in team player names are displaying as escaped hex values in-game #25

Closed cameronshinn closed 4 years ago

cameronshinn commented 4 years ago

24 is attempting to solve the issue with unicode characters in Discord usernames by preventing players with names including unicode characters from joining the queue. Turns out that the aiohttp ClientSession is converting the request JSON payload data to ASCII in the start_match() API helper function. A better fix would be to change the JSON encoder of the ClientSession to convert JSON data to unicode instead of ASCII.

thboss commented 4 years ago

we can just convert name which is decoded to Unicode here same idea here

cameronshinn commented 4 years ago

The issue isn't with get5, this is an issue with the bot. The aiohttp Python library which we use to interface with our League CS:GO API is converting the player names in the JSON from unicode to ASCII. Like that example you showed me where 'Ð å ń G è R' is converted to '\u00d0 \u00e5 \u0144 G \u00e8 R'. This conversion happens when the dictionary object is being converted to a string for the request payload.

cameronshinn commented 4 years ago

Closing with 7cc398aa7a4f15f5577b8885f0f56a3786214a74 merged