From ab44c8900d644eb1c46d4e84f39c18c3c7f42338 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 13 Oct 2021 22:41:24 +0100 Subject: [PATCH] improve test for emoji like before conversion --- worldmap/worldmap.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/worldmap/worldmap.js b/worldmap/worldmap.js index a68db03..6c56536 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -1706,8 +1706,11 @@ function setMarker(data) { opts.size = opts.size * (opts.scale || 1); // escape out any isocodes eg flag symbols var optfields = ["additionalInformation","higherFormation","specialHeadquarters","staffComments","type","uniqueDesignation","speed"]; + const regex = /\p{Extended_Pictographic}/ug; optfields.forEach(function (item) { - if (opts.hasOwnProperty(item)) { opts[item] = unescape(encodeURIComponent(opts[item])); } + if (opts.hasOwnProperty(item) && regex.test(opts[item])) { + opts[item] = unescape(encodeURIComponent(opts[item])); + } }); myMarker = myMarker.setOptions(opts); var myicon = L.icon({