❔ Unescaping special characters

Working on a little SaaS thumbnail preview tool I'm gonna sell, and special characters like apostrophes ( ' ) are getting escaped when I grab stuff from the YouTube API. How do I unescape these? I can't find anything online
10 Replies
Nate Curtiss
Nate CurtissOP2y ago
L-I-V-E-2DAY
L-I-V-E-2DAY2y ago
HttpUtility.HtmlDecode(string s), I believe
Nate Curtiss
Nate CurtissOP2y ago
Bless up that worked
L-I-V-E-2DAY
L-I-V-E-2DAY2y ago
glad to hear it
MODiX
MODiX2y ago
mtreit#6470
REPL Result: Failure
var x = HttpUtility.HtmlEncode("foo's");
Console.WriteLine(x);
Console.WriteLine(HttpUtility.HtmlDecode(x));
var x = HttpUtility.HtmlEncode("foo's");
Console.WriteLine(x);
Console.WriteLine(HttpUtility.HtmlDecode(x));
Exception: CompilationErrorException
- The name 'HttpUtility' does not exist in the current context
- The name 'HttpUtility' does not exist in the current context
- The name 'HttpUtility' does not exist in the current context
- The name 'HttpUtility' does not exist in the current context
Compile: 613.517ms | Execution: 0.000ms | React with ❌ to remove this embed.
mtreit
mtreit2y ago
😦
L-I-V-E-2DAY
L-I-V-E-2DAY2y ago
using System.Web
mtreit
mtreit2y ago
Yeah
MODiX
MODiX2y ago
mtreit#6470
REPL Result: Success
var x = System.Web.HttpUtility.HtmlEncode("foo's");
Console.WriteLine(x);
Console.WriteLine(System.Web.HttpUtility.HtmlDecode(x));
var x = System.Web.HttpUtility.HtmlEncode("foo's");
Console.WriteLine(x);
Console.WriteLine(System.Web.HttpUtility.HtmlDecode(x));
Console Output
foo's
foo's
foo's
foo's
Compile: 559.859ms | Execution: 74.312ms | React with ❌ to remove this embed.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server