From: Tom Hughes Date: Sun, 1 Dec 2013 20:31:48 +0000 (+0000) Subject: Force the X-Page-Title value to be treated as UTF-8 X-Git-Tag: live~5159 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/248d0b863cde44881574ef01b974afeb2cad12e9?hp=61bb31ebdddc9e7c317a1c6784a68874d5a0ef80 Force the X-Page-Title value to be treated as UTF-8 This is basically a black magic hack to get javascript to treat a string as UTF-8 and decode it to the correct form. http://monsur.hossa.in/2012/07/20/utf-8-in-javascript.html --- diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 1f9e6c891..1cbd97f86 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -46,7 +46,8 @@ var content = $(xhr.responseText); if (xhr.getResponseHeader('X-Page-Title')) { - document.title = xhr.getResponseHeader('X-Page-Title'); + var title = xhr.getResponseHeader('X-Page-Title'); + document.title = decodeURIComponent(escape(title)); } $('head')