Commit 7b721be7 by Tim Krones

Merge pull request #36 from open-craft/use-utf-8

Support loading resources that contain non-ASCII characters
parents e1c14356 51283d48
...@@ -8,3 +8,7 @@ It can also do some fancy things with them: ...@@ -8,3 +8,7 @@ It can also do some fancy things with them:
Default value if name is empty: {{name|default:"Default Name"}} Default value if name is empty: {{name|default:"Default Name"}}
Length of the list: {{items|length}} Length of the list: {{items|length}}
Items of the list:{% for item in items %} {{item}}{% endfor %} Items of the list:{% for item in items %} {{item}}{% endfor %}
Although it is simple, it can also contain non-ASCII characters:
Thé Fütüré øf Ønlïné Édüçätïøn Ⱡσяєм ι# Før änýøné, änýwhéré, änýtïmé Ⱡσяєм #
...@@ -12,3 +12,7 @@ Items of the list:\ ...@@ -12,3 +12,7 @@ Items of the list:\
${item}\ ${item}\
% endfor % endfor
Although it is simple, it can also contain non-ASCII characters:
Thé Fütüré øf Ønlïné Édüçätïøn Ⱡσяєм ι# Før änýøné, änýwhéré, änýtïmé Ⱡσяєм #
...@@ -36,6 +36,10 @@ It can also do some fancy things with them: ...@@ -36,6 +36,10 @@ It can also do some fancy things with them:
Default value if name is empty: {{name|default:"Default Name"}} Default value if name is empty: {{name|default:"Default Name"}}
Length of the list: {{items|length}} Length of the list: {{items|length}}
Items of the list:{% for item in items %} {{item}}{% endfor %} Items of the list:{% for item in items %} {{item}}{% endfor %}
Although it is simple, it can also contain non-ASCII characters:
Thé Fütüré øf Ønlïné Édüçätïøn Ⱡσяєм ι# Før änýøné, änýwhéré, änýtïmé Ⱡσяєм #
""" """
...@@ -56,6 +60,10 @@ It can also do some fancy things with them: ...@@ -56,6 +60,10 @@ It can also do some fancy things with them:
Default value if name is empty: This is a fine name Default value if name is empty: This is a fine name
Length of the list: 7 Length of the list: 7
Items of the list: 1 2 3 4 a b c Items of the list: 1 2 3 4 a b c
Although it is simple, it can also contain non-ASCII characters:
Thé Fütüré øf Ønlïné Édüçätïøn Ⱡσяєм ι# Før änýøné, änýwhéré, änýtïmé Ⱡσяєм #
""" """
example_id = "example-unique-id" example_id = "example-unique-id"
......
...@@ -44,7 +44,7 @@ class ResourceLoader(object): ...@@ -44,7 +44,7 @@ class ResourceLoader(object):
Gets the content of a resource Gets the content of a resource
""" """
resource_content = pkg_resources.resource_string(self.module_name, resource_path) resource_content = pkg_resources.resource_string(self.module_name, resource_path)
return unicode(resource_content) return unicode(resource_content, 'utf-8')
def render_django_template(self, template_path, context=None): def render_django_template(self, template_path, context=None):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment