Path: csiph.com!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: How to pass a php variable to a javascript file (function)? Date: Sat, 03 Oct 2015 04:35:06 +0200 Organization: PointedEars Software (PES) Lines: 191 Message-ID: <13501800.DmYS3OLCIa@PointedEars.de> References: <1739227.XXYPReGQTy@PointedEars.de> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1443839707 23541 eJwFwYEBACAEBMCVkH81jsT+I3SHRWWFE3QMxsefNc+OfVgyckwiW6tEL5EChXW+0Ll7pX4Q6xDI (3 Oct 2015 02:35:07 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sat, 3 Oct 2015 02:35:07 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwFwYEBwCAIA7CXUEqZ5yiU/09YEs7FSjCImBja4xRPNr65W1o5byAvOdIE3FZelYiy1mEGDLV7H1X7D3iwFo8= Cancel-Lock: sha1:fUPpNwbVozudrupWaaMyHImkzxE= X-NNTP-Posting-Host: eJwNwoERACEIA7CVrNIK4wji/iP8X8IlqLaJMr4fOP31ObqKGxPRxElLru3Dkas4Q410lGx8EvsQcw== Xref: csiph.com comp.lang.javascript:28804 Stefan Weiss wrote: > On 2015-10-02 21:37, Thomas 'PointedEars' Lahn wrote: >> Stefan Weiss wrote: >>> That doesn't mean that json_encode() by itself is enough to safely >>> escape strings as JavaScript literals. What if $sometext contains >>> ""? >> Not a problem in HTML5 or XHTML(5), but in HTML < 5. > > That is incorrect, see below. My description is not incorrect, but incomplete. >>> | Note: The easiest and safest way to avoid the rather strange >>> | restrictions described in this section is to always escape "