Support » Plugin: MP3-jPlayer » Javascript syntax error when caption has double quotes

  • Resolved Chris Jean


    When a caption has one or more double quotes in it, the MP3J_PLAYLISTS variable will contain syntax errors due to the unescaped quote. I found that the MP3j_Main::compare_swap function escaped the titles entry but not the artists entry, thus causing the issue. I have a patch here that shows how the same escaping can be used to fix the issue for captions.

    I should note that you can use the json_encode function to generate fully-valid Javascript data structures from a PHP data structure. This would be a much easier way to generate this output rather than hand building it and possibly creating unknown syntax error conditions based on user input. You would have to restructure your functions to simply return data structures to be fed into the json_encode function, but it would help avoid future issues such as this.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Javascript syntax error when caption has double quotes’ is closed to new replies.