View Full Version : Unusual javascript problem

04-19-2007, 03:11 PM
I'm doing a Google map containing a list of restaurants, below is the code , after I post the question.
var point = new GLatLng(48.8583, 2.2877 );
var marker = createMarker(point,'22 L Astrance ',' L Astrance Restaurant <a href="http://www.dininginfrance.com/l astrance.htm">[url]http://www.dininginfrance.com/lastrance.htm</a><img src="container/22.gif" width=101 height=76>')
The code works perfectly well , the problem is the French language interfering
with javascript code.
Take a look at the word L'Astrance, a restaurant in Paris, the apostrophe interfere with the ' used in the code, and doesn't let the map work, eliminate that apostrophe and everything is OK. Problem is that the word is spelled wrong in that case. Many French words use apostrophes , I bet there is way around it, any one knows?Thanks

04-19-2007, 03:36 PM
put a backslash ( \ ) before the apostrophe, that will escape it, or double quote the phrase and put your apostrophe in.

... '22 L\'Astrance', '22 L\'Astrance' ...

... "22 L'Astrance", "22 L'Astrance" ...