简体   繁体   中英

pebble autoescape json - unicode entities

when I use

{% autoescape "json" %}
{
    "key" : "hellü"
}
{% endautoescape %}

the result is

{
    "key" : "hell\u00FC"
}

But I dont want the strings encoded to unicode entities when I'm already creating a utf8 text file with this json string in it - it is just unneeded and unwanted.

The result should just be this:

{
    "key" : "hellü"
}

Any idea how to disable unicode entities in escape json function?

When you see the \\u\u003c/code> representation - that is escaping (not entities). So by using autoescape you escaped the json and that is good practice to avoid XSS variabilities .

If you still want to disable the autoEscaping you can do:

PebbleEngine engine = new PebbleEngine.Builder().autoEscaping(false).build(); 

For the full documentation: https://pebbletemplates.io/wiki/guide/escaping/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM