wrobstory/folium — pull request #19 by kcorbitt (2014-05-01 02:51:34+00:00)
Title: simple popups correctly escape internal quotes

Currently, Folium doesn't perform any string escaping in simple popups. As a result, if the popup text includes a double quote `"` character, javascript interprets it as the end of the string and causes an error.

For example, the following simple test case will run correctly but cause an error in the resultant javascript.
```python
import folium

ex_map = folium.Map(location=[0,0])
popup_text = 'a very "special" popup'
ex_map.polygon_marker([0,0],popup=popup_text)
ex_map.create_map("example.html")
```

The generated javascript contains the line `polygon_1.bindPopup("a very "special" popup");`, which is a syntax error.

This pull request fixes the problem by using the `json.dumps` command to escape quotes and other special characters in the popup string.