Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly escape special characters in a resource file?

I am working on a project and trying to add one string to a resource file. I've read that the resource file in an MVC 3 project is converted to XML and the special characters are automatically escaped, but that doesn't seem to be the case. I have tried using / and using %xx hexidecimal ways to enter special characters, but none of those work correctly either. Without escaping some of these characters, the code errors out. Here is the string in the resource file I'm trying to fix:

Minimum of 6 letters, numbers, and special characters, no spaces. Special characters include: !, @, #, $, %, ^, &, (, ), -, _, =, +, {, }, |, /, ?. 

As you can see at the end, I am including the usage of a number of special characters, but something in those characters is not liked when running the code. Any suggestions?

like image 774
Skrubb Avatar asked Sep 07 '25 18:09

Skrubb


1 Answers

Use the HTML codes, I just tested it and it works fine, e.g. single apostrophe ' HTML code is ’

like image 193
Adam Avatar answered Sep 10 '25 15:09

Adam