Opened 12 years ago

Closed 12 years ago

#4712 closed defect (fixed)

[patch][cla]Shrinksafe replaces unicode escaped strings

Reported by: guest Owned by: alex
Priority: high Milestone:
Component: ShrinkSafe Version: 0.9
Keywords: Cc: jbondc@…
Blocked By: Blocking:

Description

The following is taken from Microsoft AtlasControlToolkit?:

Sys.Serialization.JavaScriptSerializer?._stringRegEx=new RegExp?('["f


x00-x1F]',"i");

The build replaces to what looks in the editor as:

Sys.Serialization.JavaScriptSerializer?._stringRegEx=new RegExp?("["f


-]","i");

I can take a look at fixing this though I'm not sure where to start, rhino.diff,

+ if (!asQuotedString) { + sb.append(str); + } else { + sb.append('"'); + sb.append(ScriptRuntime?.escapeString(str)); + sb.append('"'); + }

Is that the right place?

Change History (4)

comment:1 Changed 12 years ago by guest

Looks like this is caused by:

http://trac.dojotoolkit.org/changeset/10070

comment:2 Changed 12 years ago by guest

Looks like this would do the trick:

int hexSize;

Encode non-printable or messy characters

if (c < 32
(c > 175 && c < 256) {

2-digit hex sb.append("\x"); hexSize = 2;

} else {

Unicode & ascii printable hexSize = 0; sb.append((char)c);

}

if(hexSize) {

append hexadecimal form of c left-padded with 0

for (int shift = (hexSize - 1) * 4; shift >= 0; shift -= 4) {

int digit = 0xf & (c >> shift); int hc = (digit < 10) ? '0' + digit : 'a' - 10 + digit; sb.append((char)hc);

}

}

comment:3 Changed 12 years ago by Adam Peller

Component: BuildToolsShrinkSafe
Owner: changed from James Burke to alex
Summary: Shrinksafe replaces unicode escaped strings[patch][cla]Shrinksafe replaces unicode escaped strings

comment:4 Changed 12 years ago by alex

Resolution: fixed
Status: newclosed

(In [10922]) ensure that we're UTF-8 end-to-end. Fixes #2440. Fixes #4712. Fixes #2331

Note: See TracTickets for help on using tickets.