C
C#15mo ago
Nate Curtiss

❔ 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 Curtiss15mo ago
L-I-V-E-2DAY
L-I-V-E-2DAY15mo ago
HttpUtility.HtmlDecode(string s), I believe
Nate Curtiss
Nate Curtiss15mo ago
Bless up that worked
L-I-V-E-2DAY
L-I-V-E-2DAY15mo ago
glad to hear it
MODiX
MODiX15mo 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
mtreit15mo ago
😦
L-I-V-E-2DAY
L-I-V-E-2DAY15mo ago
using System.Web
mtreit
mtreit15mo ago
Yeah
MODiX
MODiX15mo 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
Accord15mo 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
More Posts