I have created a JS template with this code to output GeoJSON for our Google Maps;

  "type": "FeatureCollection",
  "features": [
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
      "properties": {
        "name": "{title}",
        "url": "{url_title}",
        "address": "{addressline1}, {if addressline2}{addressline2}, {/if}{city}, {postalcode}",
        "icon": "/static/markers/place.png"

However, some of the titles have an apostrophe or accented characters, which are being included in the GeoJSON like so;

Bar ‘67
Café and Bar

I was wondering if anyone knows how I can correct this?


  • just for sure - is your JS file output with utf-8 in header? "Content-Type:text/javascript; charset=UTF-8"?
    – Max Lazar
    Commented Oct 8, 2014 at 11:15
  • Hi Max, it doesn't appear to be. The template has been created with type JavaScript but in Developer Tools i'm seeing; Content-Type:text/javascript and no encoding. Commented Oct 8, 2014 at 13:41
  • so this is your answer - u need to add utf-8. If your server works with .htaccess - try to add line AddDefaultCharset UTF-8
    – Max Lazar
    Commented Oct 8, 2014 at 18:18

1 Answer 1


As we discus in comments, its most probable that you have this issue because server is not return correct charset (utf-8) by default. You can try next:

for apache - add into .htaccess:

AddDefaultCharset utf-8

for nginx:

charset utf-8;

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.