0

I'm using express-validator to sanitize and escape the inputs from body, the input is 2/1 I sanitize as follows:

body("abbreviation")
      .notEmpty()
      .isLength({ min: 2, max: 11 })
      .trim()
      .escape()
      .matches(/[A-Za-z\d ._\-)(\\/]*/)

the value stored in Database after sanitizing is 2/1

and when I render the value to front end it shows as the escaped version, it doesn't covert to html symbols, and I'm using charset="UTF-8" the code in html using JSX:

<h2>{classAbbreviation}</h2>

0 Answers0