C
C#4w ago
Auxl

Uri.TryCreate failing when input is from Chinese localized text

I'm sorry in advance if I'm rambling :email: I have text command that accepts a url from a user, my program needs to verify that the user input is actually a url. So I run it through Uri.TryCreate. The problem I'm having is that when the input is by a user who has a system set to the Chinese language, when inputting a valid url it always fails. I found that this is because their system gives a slightly different set of english characters that normal. Not sure if it will be visible in discord but these are their and my versions of input text. I'll include a screenshot of the text in a different editor just in case.
?editmsg ⁠⁠https://discord.com/channels/1209429896317771796/1240493902256013363/1245956914366386219
?editmsg https://discord.com/channels/1209429896317771796/1240493902256013363/1245956914366386219
?editmsg ⁠⁠https://discord.com/channels/1209429896317771796/1240493902256013363/1245956914366386219
?editmsg https://discord.com/channels/1209429896317771796/1240493902256013363/1245956914366386219
The code I have to detect that the message is a command, that the command is valid, and forwarding the command to an action, all works just fine without any special logic to handle the alternate unicode seen here. I'm wondering if there's any specific work around I'm supposed to do to be able to processes text of this kind into a Uri. Or, since dotnet seems to handle the text without any special logic on my end in other areas, this is something I need to submit as an issue with dotnet itself.
No description
2 Replies
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
SleepWellPupper
Could you provide some code and possibly a minimum viable example so that we may reproduce the issue?

Did you find this page helpful?