diff --git a/core/views/expo.py b/core/views/expo.py index f225c93..f39c3dd 100644 --- a/core/views/expo.py +++ b/core/views/expo.py @@ -19,6 +19,9 @@ from troggle.core.models.caves import Cave import troggle.core.views.caves import troggle.settings as settings +import sys +sysdefaultencoding = sys.getdefaultencoding() + '''Formerly a separate package called 'flatpages' written by Martin Green 2011. This was NOT django.contrib.flatpages which stores HTML in the database, so the name was changed to expopages. Then it was incorporated into troggle directly, rather than being an unnecessary external package. @@ -224,7 +227,7 @@ def expopage(request, path): try: t = type(filetobeopened) - content = open(filetobeopened.encode('utf8'), "rb") + content = open(filetobeopened.encode(sysdefaultencoding), "rb") content_type=getmimetype(path) return HttpResponse(content = content, content_type=content_type) except IOError: