OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "net/base/escape.h" | 7 #include "net/base/escape.h" |
8 | 8 |
9 #include "base/i18n/icu_string_conversions.h" | 9 #include "base/i18n/icu_string_conversions.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // query and that could change the server's parsing of the query. | 92 // query and that could change the server's parsing of the query. |
93 const char kUrlUnescape[128] = { | 93 const char kUrlUnescape[128] = { |
94 // NULL, control chars... | 94 // NULL, control chars... |
95 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 95 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
96 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 96 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
97 // ' ' ! " # $ % & ' ( ) * + , - . / | 97 // ' ' ! " # $ % & ' ( ) * + , - . / |
98 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, | 98 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, |
99 // 0 1 2 3 4 5 6 7 8 9 : ; < = > ? | 99 // 0 1 2 3 4 5 6 7 8 9 : ; < = > ? |
100 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, | 100 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, |
101 // @ A B C D E F G H I J K L M N O | 101 // @ A B C D E F G H I J K L M N O |
102 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 102 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
103 // P Q R S T U V W X Y Z [ \ ] ^ _ | 103 // P Q R S T U V W X Y Z [ \ ] ^ _ |
104 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 104 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
105 // ` a b c d e f g h i j k l m n o | 105 // ` a b c d e f g h i j k l m n o |
106 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 106 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
107 // p q r s t u v w x y z { | } ~ <NBSP> | 107 // p q r s t u v w x y z { | } ~ <NBSP> |
108 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 | 108 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 |
109 }; | 109 }; |
110 | 110 |
111 template<typename STR> | 111 template<typename STR> |
112 STR UnescapeURLImpl(const STR& escaped_text, | 112 STR UnescapeURLImpl(const STR& escaped_text, |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 if (text.find(ampersand_chars[i], index) == index) { | 367 if (text.find(ampersand_chars[i], index) == index) { |
368 text.replace(iter, iter + ampersand_chars[i].length(), | 368 text.replace(iter, iter + ampersand_chars[i].length(), |
369 1, kEscapeToChars[i].replacement); | 369 1, kEscapeToChars[i].replacement); |
370 break; | 370 break; |
371 } | 371 } |
372 } | 372 } |
373 } | 373 } |
374 } | 374 } |
375 return text; | 375 return text; |
376 } | 376 } |
OLD | NEW |