How does the ejs template engine render unicode strings

  node.js, question

Well, here’s the thing. I have a unicode string

var str = "\u7e41\u661f";

When using ejs plus express in node
node

response.render('eg.ejs', {obj: {a: str}});

eg.ejs

<script>
 Var obj =' < percentage = obj.a percentage >'
 </script>

The result is

<script>
 Var obj =' stars'
 </script>

What I want is

<script>
 var obj = '\u7e41\u661f'
 </script>

May I know what to do?

Use escape
Var obj =' stars'
Then convert to \u form and write like this:
Var str = escape(obj).replace(/ percentage u/g,'\\u');
If you want to turn it around, use unescape.
Unescape (str.replace (\ \ u/g,' percentage u'))