dealing with nested quotes in html generated from c#
问题 i am using a 3rd party library to show tooltips, like so: string tooltip = "test"; output.Write("onmouseover='Tip(\"" + test + "\");'"); // work fine :) i'm having problem with situations like the following where i need quotes for formatting: string tooltip = "<span style='color:red;'>test</span>"; output.Write("onmouseover='Tip(\"" + test + "\");'"); // no working :( how can i escape the quotes needed for the html in the tooltip so it doesn't break the function call? 回答1: Replace any