Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Side by Side Diff: runtime/bin/vmservice/observatory/lib/src/elements/observatory_element.dart

Issue 558853004: Preserve the contents of Dart strings with unmatched surrogate halfs by avoiding a UTF16 -> UTF8 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: sync and build Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library observatory_element; 5 library observatory_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'package:observatory/app.dart'; 9 import 'package:observatory/app.dart';
10 import 'package:polymer/polymer.dart'; 10 import 'package:polymer/polymer.dart';
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 for (int codeUnit in value.codeUnits) { 118 for (int codeUnit in value.codeUnits) {
119 if (codeUnit == '\n'.codeUnitAt(0)) result.addAll('\\n'.codeUnits); 119 if (codeUnit == '\n'.codeUnitAt(0)) result.addAll('\\n'.codeUnits);
120 else if (codeUnit == '\r'.codeUnitAt(0)) result.addAll('\\r'.codeUnits); 120 else if (codeUnit == '\r'.codeUnitAt(0)) result.addAll('\\r'.codeUnits);
121 else if (codeUnit == '\f'.codeUnitAt(0)) result.addAll('\\f'.codeUnits); 121 else if (codeUnit == '\f'.codeUnitAt(0)) result.addAll('\\f'.codeUnits);
122 else if (codeUnit == '\b'.codeUnitAt(0)) result.addAll('\\b'.codeUnits); 122 else if (codeUnit == '\b'.codeUnitAt(0)) result.addAll('\\b'.codeUnits);
123 else if (codeUnit == '\t'.codeUnitAt(0)) result.addAll('\\t'.codeUnits); 123 else if (codeUnit == '\t'.codeUnitAt(0)) result.addAll('\\t'.codeUnits);
124 else if (codeUnit == '\v'.codeUnitAt(0)) result.addAll('\\v'.codeUnits); 124 else if (codeUnit == '\v'.codeUnitAt(0)) result.addAll('\\v'.codeUnits);
125 else if (codeUnit == '\$'.codeUnitAt(0)) result.addAll('\\\$'.codeUnits); 125 else if (codeUnit == '\$'.codeUnitAt(0)) result.addAll('\\\$'.codeUnits);
126 else if (codeUnit == '\\'.codeUnitAt(0)) result.addAll('\\\\'.codeUnits); 126 else if (codeUnit == '\\'.codeUnitAt(0)) result.addAll('\\\\'.codeUnits);
127 else if (codeUnit == "'".codeUnitAt(0)) result.addAll("'".codeUnits); 127 else if (codeUnit == "'".codeUnitAt(0)) result.addAll("'".codeUnits);
128 else if (codeUnit < 32) result.addAll("\\u$codeUnit".codeUnits); 128 else if (codeUnit < 32) {
129 else result.add(codeUnit); 129 var escapeSequence = "\\u" + codeUnit.toRadixString(16).padLeft(4, "0") ;
130 result.addAll(escapeSequence.codeUnits);
131 } else result.add(codeUnit);
130 } 132 }
131 if (wasTruncated) { 133 if (wasTruncated) {
132 result.addAll("...".codeUnits); 134 result.addAll("...".codeUnits);
133 } else { 135 } else {
134 result.add("'".codeUnitAt(0)); 136 result.add("'".codeUnitAt(0));
135 } 137 }
136 return new String.fromCharCodes(result); 138 return new String.fromCharCodes(result);
137 } 139 }
138 } 140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698