Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #4867

Re: Java code to output escaped Javascript?

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!lust.ihug.co.nz!ihug.co.nz!not-for-mail
From Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand>
Newsgroups comp.lang.java.programmer
Subject Re: Java code to output escaped Javascript?
Followup-To comp.lang.java.programmer
Date Thu, 02 Jun 2011 10:17:13 +1200
Organization Geek Central
Lines 15
Message-ID <is6dp9$8h5$2@lust.ihug.co.nz> (permalink)
References <b9498e86-bb2c-4838-9ad1-61a71f3980e0@e35g2000yqc.googlegroups.com> <is5jk2$l36$1@dont-email.me>
NNTP-Posting-Host 118-92-86-36.dsl.dyn.ihug.co.nz
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace lust.ihug.co.nz 1306966633 8741 118.92.86.36 (1 Jun 2011 22:17:13 GMT)
X-Complaints-To abuse@ihug.co.nz
NNTP-Posting-Date Wed, 1 Jun 2011 22:17:13 +0000 (UTC)
User-Agent KNode/4.4.11
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4867

Followups directed to: comp.lang.java.programmer

Show key headers only | View raw


In message <is5jk2$l36$1@dont-email.me>, Joshua Cranmer wrote:

> On 06/01/2011 09:11 AM, laredotornado wrote:
>
>> private String escapeForJS(String value) {
>> value = value.replace("\n", "\\n");
>> value = value.replace("\r", "\\r");
>> value = value.replace("\"", "\\\"");
>> return value;
>> }
> 
> You also forgot `\' as well as every character in the range
> '\u0000'-'\u001f' and '\u007f-\uffff' ...

Can’t they just occur literally?

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Java code to output escaped Javascript? laredotornado <laredotornado@zipmail.com> - 2011-06-01 06:11 -0700
  Re: Java code to output escaped Javascript? Travers Naran <tnaran@gmail.com> - 2011-06-01 07:47 -0700
  Re: Java code to output escaped Javascript? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-01 10:50 -0400
    Re: Java code to output escaped Javascript? "laredotornado@zipmail.com" <laredotornado@gmail.com> - 2011-06-01 09:58 -0700
    Re: Java code to output escaped Javascript? Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-02 10:17 +1200
      Re: Java code to output escaped Javascript? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-01 21:47 -0400

csiph-web