ijse / freemarker.js

make freemarker available for node.js with FMPP.
http://freemarker.js.org/
MIT License
111 stars 41 forks source link

Handing Objects to Templates #17

Open HoverBaum opened 8 years ago

HoverBaum commented 8 years ago

Stumbled upon a problem with handing Objects to templates and then working with them.

My use case: Hand an Object to a template, use a freemarker function to turn it into a string, assign that string to a JS variable.

I created a minimal example to illustrate my problem at https://github.com/HoverBaum/test-freemarker-variables

What I am experiencing is that accessing properties of my Object gives me byte buffers.
I managed to find a hackaround by passing my Object as a JSON string and converting that to a FreeMarker Object. However I feel like this should not be necessary and it breaks some chinese characters.

Possibly related to #16 who seems to want to do something similar and #11 who has problems with Chinese characters.