When we base64 decode the iframe for in notebooks we use JS atob. This function doesn't handle characters with multiple code units as expected. Mitigate this by not using base64 encoding, but percent-encoding. On the JS side we can decode this with decodeURIComponent without issues.
Example:
>>> title = '5/7 %, Линейная улица, é "Berdsk"'
>>> title.encode('utf-8')
b'5/7 %, \xd0\x9b\xd0\xb8\xd0\xbd\xd0\xb5\xd0\xb9\xd0\xbd\xd0\xb0\xd1\x8f \xd1\x83\xd0\xbb\xd0\xb8\xd1\x86\xd0\xb0, \xc3\xa9 "Berdsk"'
>>> urllib.parse.quote(title)
'5/7%20%25%2C%20%D0%9B%D0%B8%D0%BD%D0%B5%D0%B9%D0%BD%D0%B0%D1%8F%20%D1%83%D0%BB%D0%B8%D1%86%D0%B0%2C%20%C3%A9%20%22Berdsk%22'
Close https://github.com/python-visualization/folium/issues/1320
When we base64 decode the iframe for in notebooks we use JS
atob
. This function doesn't handle characters with multiple code units as expected. Mitigate this by not using base64 encoding, but percent-encoding. On the JS side we can decode this withdecodeURIComponent
without issues.Example:
--- To do ---