abenzer / represent-map

Visualize your startup community on a custom Google map. Based on the code for http://represent.la
http://represent.la
358 stars 189 forks source link

Map display and Startups label have disappeared #80

Closed odebroqueville closed 8 years ago

odebroqueville commented 8 years ago

I added data to the MySQL database using phpMyAdmin and changed the structure of the places table to allow for certain NULL values. Now, the Startups label no longer appears in the right sidebar and the map doesn't get displayed. Please see here: www.geneva-startups.ch Is there a limited number of startups one can add? (I added 1'315 startups)

odebroqueville commented 8 years ago

It appears that the problem had to do with encoding. I changed lines 185 to 188 of index.php as follows:

          $place[title] = utf8_encode(htmlspecialchars_decode(addslashes(htmlspecialchars($place[title]))),ENT_COMPAT,'UTF-8', false);
          $place[description] = utf8_encode(str_replace(array("\n", "\t", "\r"), "", htmlspecialchars_decode(addslashes(htmlspecialchars($place[description])))),ENT_COMPAT,'UTF-8', false);
          $place[uri] = utf8_encode(addslashes(htmlspecialchars($place[uri])),ENT_COMPAT,'UTF-8', false);
          $place[address] = utf8_encode(htmlspecialchars_decode(addslashes(htmlspecialchars($place[address]))),ENT_COMPAT,'UTF-8', false);

This solved the problem.

abenzer commented 8 years ago

Cool, thanks for the update. Glad you worked it out.

odebroqueville commented 8 years ago

Actually, the problem is half solved! I've got the markers and the map displayed now, but the labels and infowindows are empty!

abenzer commented 8 years ago

Do you see any JS errors in your console when loading the page?

odebroqueville commented 8 years ago

Nope! I just see the following: Google Maps API warning: SensorNotRequired: https://developers.google.com/maps/documentation/javascript/error-messages which refers to util.js line 32. I think the problem still has to do with the encoding somehow! Or rather, the data isn't being pushed to the markers for some reason!

odebroqueville commented 8 years ago

Alex, Would you please tell me what you are trying to do with this code: htmlspecialchars_decode(addslashes(htmlspecialchars($place[title]))) It doesn't appear to be working for French and German. I'm really struggling to find an alternative with a wider scope in terms of compatible languages.

odebroqueville commented 8 years ago

I tried changing the charset to ISO-8859-1. The web page source looks fine, but it just won't render on the map.

odebroqueville commented 8 years ago

Finally working! Good God, that was a tough one to crack! Here's the code that I changed: $place[title] = htmlentities($place[title],ENT_QUOTES,"ISO-8859-1"); $place[description] = htmlentities(str_replace(array("\n", "\t", "\r"), "", $place[description]),ENT_QUOTES,"ISO-8859-1"); $place[uri] = htmlentities($place[uri],ENT_QUOTES,"ISO-8859-1"); $place[address] = htmlentities(str_replace(array("\n", "\t", "\r"), "", $place[address]),ENT_QUOTES,"ISO-8859-1");