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

Unified Diff: pkg/analysis_server/lib/src/status/utilities.dart

Issue 855643004: Use UTF-8 when serving web pages for analysis server debug. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/status/utilities.dart
diff --git a/pkg/analysis_server/lib/src/status/utilities.dart b/pkg/analysis_server/lib/src/status/utilities.dart
deleted file mode 100644
index e532f7c496994d234985139e967de2ea869c275c..0000000000000000000000000000000000000000
--- a/pkg/analysis_server/lib/src/status/utilities.dart
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library analysis_server.src.status.utilities;
-
-/**
- * Encode the characters in the given [string] so that they are safe for
- * inclusion in HTML.
- */
-String encodeHtml(String string) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < string.length; i++) {
- int char = string.codeUnitAt(i);
- if ((char >= 'a'.codeUnitAt(0) && char <= 'z'.codeUnitAt(0)) ||
- (char >= 'A'.codeUnitAt(0) && char <= 'Z'.codeUnitAt(0)) ||
- (char >= '0'.codeUnitAt(0) && char <= '9'.codeUnitAt(0)) ||
- char == '_'.codeUnitAt(0) ||
- char == '#'.codeUnitAt(0) ||
- char == ','.codeUnitAt(0) ||
- char == '.'.codeUnitAt(0) ||
- char == ';'.codeUnitAt(0) ||
- char == ':'.codeUnitAt(0) ||
- char == '('.codeUnitAt(0) ||
- char == ')'.codeUnitAt(0) ||
- char == '['.codeUnitAt(0) ||
- char == ']'.codeUnitAt(0) ||
- char == '{'.codeUnitAt(0) ||
- char == '}'.codeUnitAt(0) ||
- char == ' '.codeUnitAt(0) ||
- char == '='.codeUnitAt(0) ||
- char == '+'.codeUnitAt(0) ||
- char == '-'.codeUnitAt(0) ||
- char == '*'.codeUnitAt(0) ||
- char == '%'.codeUnitAt(0)) {
- buffer.writeCharCode(char);
- } else if (char == '<'.codeUnitAt(0)) {
- buffer.write('&lt;');
- } else if (char == '>'.codeUnitAt(0)) {
- buffer.write('&gt;');
- } else if (char == '&'.codeUnitAt(0)) {
- buffer.write('&amp;');
- } else if (char == '"'.codeUnitAt(0)) {
- buffer.write('&quot;');
- } else if (char == "'".codeUnitAt(0)) {
- buffer.write('&#x27;');
- } else if (char == '/'.codeUnitAt(0)) {
- buffer.write('&#x2F;');
- } else if (char == 0x2192) {
- buffer.write('&rarr;');
- } else if (char == 0x00A0) {
- buffer.write('&nbsp;');
- } else {
- buffer.write('<b>x${char.toRadixString(16)};</b>');
- }
- }
- return buffer.toString();
-}

Powered by Google App Engine
This is Rietveld 408576698