Page 1 of 1

CGGoogleMaps2 – encoding problem with point text

Posted: Fri Sep 22, 2017 9:39 am
by Charles Butcher
In CGGoogleMaps2, I have a problem with broken HTML for the text in the box that pops up when you click on a map point.

As I understand it, the help file says this box (the "info window") expects HTML, so quotes are escaped, but the content is not converted to HTML entities.

In practice, though, when I enter:

Code: Select all

<p><img style="float: right; margin-left: 15px; border: 1px solid black;" src="uploads/images/map_icons/Pit.jpg" alt="The Pit" width="100" height="66" />Stanhoe’s famous duckpond is known to locals as “The Pit”.</p>
it renders as:

Code: Select all

<p><img style="\"float:" right;="" margin-left:="" 15px;="" border:="" 1px="" solid="" black;\"="" src="\"uploads/images/map_icons/Pit.jpg\"" alt="\"The" pit\"="" width="\"100\"" height="\"66\"">"Stanhoe’s famous duckpond is known to locals as “The Pit”.</p>"
It's as if more quotes get added, quotes are escaped, and some of the quotes are encoded. I'm not sure in which order! In practice, the text displays OK but the thumbnail images don't.

I’m currently using CGGoogleMaps2 1.1.1 with CGExtensions 1.56.2 and CGSimpleSmarty 2.16. CMSms 2.2.3.1. However, it was broken (presumably from the same cause) back in CMSms 1.x, from which I've only just upgraded.

Map in question is at http://stanhoe.org/about/map. Apart from this issue, the map (and others on the same site) works fine.

Suggestions would be much appreciated.

Re: CGGoogleMaps2 – encoding problem with point text

Posted: Fri Sep 22, 2017 4:04 pm
by calguy1000
I just tested inserting an image as raw HTML in the 'text' field when editing a marker in CGGoogleMaps2 and it worked properly.

I also entered this text into the content area of a page, and it worked properly (WYSIWYG disabled):

Code: Select all

{$txt='<img src="http://calguy1000.dynu.com/cms2_adodb/uploads/images/abrams.png" alt="abrams" width="128" height="128"/>'}
{cggm2_add_dynpoint name='Cranbrook' address='Cranbrook, BC' tooltip='This is cranbrook' description=$txt}
{CGGoogleMaps2}
If you are using a WYSIWYG editor when entering logic and design code such as this, then the WYSIWYG editor may be getting in your way.

I used CGGoogleMaps v1.1.2 but it has not changed significantly in months.

Re: CGGoogleMaps2 – encoding problem with point text

Posted: Fri Sep 22, 2017 4:47 pm
by Charles Butcher
Thank you Robert. I normally use MicroTiny, but the entry field in CGGoogleMaps doesn't appear to support WYSIWYG, and in any case disabling MicroTiny made no difference.

I didn't really think there was anything wrong with your fine module, so I guess the problem lies elsewhere. Magic quotes are off in php.ini, and I've never noticed a similar problem with the output HTML.

I tried creating a new map, but it suffers the same problem.

Unfortunately I couldn't get your example with the dynamic point to work. I get a map, but Cranbrook does not feature on it.

Re: CGGoogleMaps2 – encoding problem with point text

Posted: Fri Sep 22, 2017 5:09 pm
by calguy1000
Here's a screenshot of the add/edit-map-point form

Re: CGGoogleMaps2 – encoding problem with point text

Posted: Fri Sep 22, 2017 9:38 pm
by Charles Butcher
Thanks. Mine looks just the same. The "Text:" area works fine with plain text, but chokes on HTML. Latest output looks a bit different, but still lots of escaping going on:

Code: Select all

<p><img style=\\\"float: right; margin-left: 15px; border: 1px solid black;\\\" src=\\\"uploads\/images\/map_icons\/Pit.jpg\\\" alt=\\\"The Pit\\\" width=\\\"100\\\" height=\\\"66\\\" \/>Stanhoe\u2019s famous duckpond is known to locals as \u201cThe Pit\u201d.<\/p>
The browser struggles bravely with this and generally renders the text, but links and images don't work.

This doesn't depend on having a Google API key, does it? I've just created one and put it into CGGoogleMaps2, but Google is still flagging a warning via the browser console. Shows the map OK, though.