1

I have a problem regarding Leaflet and calvinmetcalf's shapefile module. In my shapefile I have fields and in those fields are strings like:

'Frankfurt'
'Tübingen'
'Géramer-sur-Mer'

You see that due to the special characters in the shapefile fields, on my Leaflet I get strange outputs. I think that is due to the UTF-8 restrictions. Since my data is not loaded on a regular webpage using a .html file, but using a Sharepoint webpart, how on earth can I show the special characters? For sure, I added above the <meta charset="utf-8"/>. Am I missing something?

2
  • 1
    You'll need to provide more information - how does the output look like and, if possible, details about the encoding of the shapefile text (do you have a .cpg sidecar file?). Utilities like ogrinfo (gdal.org/programs/ogrinfo.html#ogrinfo) will display that kind of metadata from the shapefile. Jun 10, 2021 at 17:07
  • The metadata shows correctly UTF-8 and the .cpg-file even has this info saved.
    – Cliff
    Jun 29, 2021 at 13:04

1 Answer 1

1

utf-8 can display pretty much anything - characters up to 4 bytes gives, as you probably know, about 4 billion possible characters. In fact, utf-8 is about the least restrictive character set there is (hence the wide use).

"strange outputs" is a poor substitute for a screenshot, but there are a few things worth checking:

  1. Is the input data (the shapefile) in utf-8?
  2. Does the shapefile display correctly in, eg qgis/openlayers/whatever else is handy?
  3. What characters are actually being parsed from the Shapefile (ie via console.log())
  4. Does the font you are using have glyphs for those special characters

If it were me, I'd go for #2 first and use that to do #1 if I could do it in 5 minutes or less, and then move to #3, which should give you some insight on #4.

1
  • 1) According to FME & QGIS the shapefile is in UTF-8 format. 2) Shapefile does display correctly. Only the special characters are not showing correctly. 3) I checked that console.log()-thing but I do not see how and what to do there. 4) I use the standard Leaflet font (I used the example from the Leaftlet page and only loaded the shapefile in it).
    – Cliff
    Jun 29, 2021 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.