Skip to content

Commit

Permalink
Specify UTF encoding in JSON tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
alno authored and migurski committed Jul 6, 2012
1 parent 571401c commit 845b7d9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion TileStache/Goodies/Providers/MapnikGrid.py
Expand Up @@ -109,7 +109,7 @@ def getTypeByExtension(self, extension):
if extension.lower() != 'json':
raise KnownUnknown('MapnikGrid only makes .json tiles, not "%s"' % extension)

return 'application/json', 'JSON'
return 'application/json; charset=utf-8', 'JSON'

class SaveableResponse:
""" Wrapper class for JSON response that makes it behave like a PIL.Image object.
Expand Down
2 changes: 1 addition & 1 deletion TileStache/Mapnik.py
Expand Up @@ -252,7 +252,7 @@ def getTypeByExtension(self, extension):
if extension.lower() != 'json':
raise KnownUnknown('MapnikGrid only makes .json tiles, not "%s"' % extension)

return 'application/json', 'JSON'
return 'application/json; charset=utf-8', 'JSON'

class SaveableResponse:
""" Wrapper class for JSON response that makes it behave like a PIL.Image object.
Expand Down
2 changes: 1 addition & 1 deletion TileStache/__init__.py
Expand Up @@ -287,7 +287,7 @@ def requestHandler(config_hint, path_info, query_string):
mimetype, content = getTile(layer, coord, extension)

if callback and 'json' in mimetype:
mimetype, content = 'application/javascript', '%s(%s)' % (callback, content)
mimetype, content = 'application/javascript; charset=utf-8', '%s(%s)' % (callback, content)

except Core.KnownUnknown, e:
out = StringIO()
Expand Down

0 comments on commit 845b7d9

Please sign in to comment.