From b50208f82ee22f8d158b7a6f9bb3c867ddd68d05 Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Tue, 06 Dec 2016 21:08:41 +0000 Subject: [PATCH] Decode non-latin characters in stop names autocompletion --- index.js | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/index.js b/index.js index 54b901a..12d1c79 100644 --- a/index.js +++ b/index.js @@ -264,6 +264,12 @@ }, interval); } +var decodeEntitiesTextArea = document.createElement('textarea'); +function decodeEntities(text) { + decodeEntitiesTextArea.innerHTML = text; + return decodeEntitiesTextArea.value; +} + function init() { if(!window.jQuery) { fail('Required JavaScript jQuery library failed to load. You may try refreshing the page.'); @@ -287,7 +293,7 @@ for(var i = 1, il = data.length; i < il; i++) { var opt = document.createElement('option'); opt.value = data[i].id; - opt.appendChild(document.createTextNode(data[i].name)); + setText(opt, decodeEntities(data[i].name)); stop_name_autocomplete.appendChild(opt); } -- Gitblit v1.9.1