Resource file variable giving string ASCII code is

2019-08-15 02:31发布

问题:

I have a variable in a resource file (.resx), the value having the word you'd.

When I try to use this variable directly in an alert box it displays you'd as you'd.

What could be the issue? and how do I resolve it?

回答1:

Try this:

alert('@System.Web.HttpUtility.JavaScriptStringEncode("Hello, You'd like this.")');