improve test for emoji like before conversion

This commit is contained in:
Dave Conway-Jones 2021-10-13 22:41:24 +01:00
parent 8e98bad30f
commit ab44c8900d
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF

View File

@ -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({