Python Forum

Full Version: Parsing a YAML file without changing the string content..?, Flask - solved.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone,

I'm using a yaml file to load the text for a html page (Flask, Jinja)

extract of my YAML
Title: This is a <b>test</b>

but this will be parsed in my html as ->
Title: This is a &lt;b&gt;test&lt;/b&gt;

and for example an will be "converted" as €

and ideas how to keep those characters as they are ?

Thanks
I made some test and it the same with a simple

	
with open('test.txt', 'r') as file2:
  tyml = file2.read()

return render_template('index.html', TYML = tyml )
So either it's when I read the file with open or when I pass the variable to flask with render... humm Wall
Oh !

I believe I found ->

https://flask.palletsprojects.com/en/2.0.x/templating/

Quote:{% autoescape false %}
<p>autoescaping is disabled here
<p>{{ will_not_be_escaped }}
{% endautoescape %}

I'll make some try now... Pray
edit: it work Dance