I can successfully load and display a shapefile in Leaflet. However, when I try to access the features properties, the characters are all mangled. To investigate, I defined the following function:
function unpack(str) {
var codePoints = [];
for(var i = 0; i < str.length; i++)
codePoints.push( str.charCodeAt(i) );
return codePoints;
};
Then, I do the following:
const options = {
onEachFeature: (feature, layer) => {
console.log(unpack(feature.properties.NAME));
}
};
L.shapefile(url, options);
When I load the application I see on the console arrays like the following:
[65533, 65533, 65533, 65533, 65533, 65533, 65533, 65533, 65533, 65533, 65533, 65533]
... which corresponds to the Unicode replacement character.
For what it's worth, I've examined the *.dbf file using a binary editor and I've established that the feature.properties.NAME
is given in ISO 8859-7 (ISO Latin/Greek alphabet).