leforestier/yattag

support Unicode escape sequence in text()

sandrotosi opened this issue · 2 comments

if i want to add a unicode escape sequence, say an emoji, i'd need to enter a string like &#x1F44D bit yattag text() will escape it to &#x1F44D which renders the verbatim string &#x1F44D instead of the thumbs-up emoji.

it would be great if we could have an option to not escape strings and/or any other way you see fit to support unicode sequences.

thanks!

Hi,

if you declare the document as being utf-8 encoded, you can do this:

    text('♬ Ob-La-Di, Ob-La-Da ♬')

or in case your code editor doesn't display utf-8 characters:

    text('\u266C Ob-La-Di, Ob-La-Da \u266C')

You can see a more thorough reply I gave to the same question here: #45

By the way, you always have the option to insert text without escaping, that's what the asis method is for.