changeset 82:8596a1d97740

unicode
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 29 Nov 2013 20:45:20 -0800
parents bb289832e061
children 78139c3cecfa
files decoupage/templates/head.html decoupage/web.py setup.py
diffstat 3 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/decoupage/templates/head.html	Fri Jul 05 14:03:12 2013 -0700
+++ b/decoupage/templates/head.html	Fri Nov 29 20:45:20 2013 -0800
@@ -3,6 +3,7 @@
       xmlns:xi="http://www.w3.org/2001/XInclude"
       py:strip="True">
   <!-- generic head template to be <xi:include>-d -->
+  <meta charset="utf-8"></meta>
   <title>${title or path}</title>
   <link py:if="icon" rel="icon" href="${icon}"/>
   <link py:for="sheet in css or ()" rel="stylesheet" type="text/css" href="${sheet}"/>
--- a/decoupage/web.py	Fri Jul 05 14:03:12 2013 -0700
+++ b/decoupage/web.py	Fri Nov 29 20:45:20 2013 -0800
@@ -3,7 +3,7 @@
 """
 
 # TODO:
-# files like `index.ini`
+# handle files with `#`s like like `#index.ini`
 # -> http://k0s.org/portfolio/ideas/#index.ini#
 #
 # oops. Handle it better
@@ -38,7 +38,8 @@
                  'directory': None, # directory to serve
                  'cascade': 'True', # whether to cascade configuration
                  'template': 'index.html', # XXX see below
-                 'template_directories': '' # list of directories to look for templates
+                 'template_directories': '', # list of directories to look for templates
+                 'charset': 'utf-8', # content encoding for index.html files; -> `Content-Type: text/html; charset=ISO-8859-1`
                  }
 
     def __init__(self, **kw):
@@ -103,7 +104,6 @@
                                      auto_reload=self.auto_reload)
 
 
-
     ### methods dealing with HTTP
 
     def __call__(self, environ, start_response):
@@ -234,8 +234,13 @@
                 return self.fileserver(local_index)
             raise
 
+        # set charset if given
+        kw = {}
+        if self.charset:
+            kw['charset'] = self.charset
+
         # return response
-        return Response(content_type='text/html', body=res)
+        return Response(content_type='text/html', body=res, **kw)
 
 
     ### internal methods
--- a/setup.py	Fri Jul 05 14:03:12 2013 -0700
+++ b/setup.py	Fri Nov 29 20:45:20 2013 -0800
@@ -6,7 +6,7 @@
 except IOError:
     description = ''
 
-version = '0.12.1'
+version = '0.12.2'
 
 setup(name='decoupage',
       version=version,