Results 1 to 2 of 2

Thread: Unusual javascript problem

  1. #1
    Join Date
    Oct 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Unusual javascript problem

    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>')
    map.addOverlay(marker);
    *****
    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

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    put a backslash ( \ ) before the apostrophe, that will escape it, or double quote the phrase and put your apostrophe in.

    Code:
    ... '22 L\'Astrance', '22 L\'Astrance' ...
    or
    Code:
    ... "22 L'Astrance", "22 L'Astrance" ...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •