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

Side by Side Diff: sdk/lib/convert/utf.dart

Issue 2707893002: Improve documentation for utf8 decoder (and BOMs). (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 part of dart.convert; 5 part of dart.convert;
6 6
7 /** The Unicode Replacement character `U+FFFD` (�). */ 7 /** The Unicode Replacement character `U+FFFD` (�). */
8 const int UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD; 8 const int UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD;
9 9
10 /** The Unicode Byte Order Marker (BOM) character `U+FEFF`. */ 10 /** The Unicode Byte Order Marker (BOM) character `U+FEFF`. */
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 const Utf8Decoder({ bool allowMalformed: false }) 323 const Utf8Decoder({ bool allowMalformed: false })
324 : this._allowMalformed = allowMalformed; 324 : this._allowMalformed = allowMalformed;
325 325
326 /** 326 /**
327 * Converts the UTF-8 [codeUnits] (a list of unsigned 8-bit integers) to the 327 * Converts the UTF-8 [codeUnits] (a list of unsigned 8-bit integers) to the
328 * corresponding string. 328 * corresponding string.
329 * 329 *
330 * Uses the code units from [start] to, but no including, [end]. 330 * Uses the code units from [start] to, but no including, [end].
331 * If [end] is omitted, it defaults to `codeUnits.length`. 331 * If [end] is omitted, it defaults to `codeUnits.length`.
332 * 332 *
333 * If the [codeUnits] start with a leading [UNICODE_BOM_CHARACTER_RUNE] this 333 * If the [codeUnits] start with the encoding of a
334 * character is discarded. 334 * [UNICODE_BOM_CHARACTER_RUNE], that character is discarded.
335 */ 335 */
336 String convert(List<int> codeUnits, [int start = 0, int end]) { 336 String convert(List<int> codeUnits, [int start = 0, int end]) {
337 // Allow the implementation to intercept and specialize based on the type 337 // Allow the implementation to intercept and specialize based on the type
338 // of codeUnits. 338 // of codeUnits.
339 String result = _convertIntercepted(_allowMalformed, codeUnits, start, end); 339 String result = _convertIntercepted(_allowMalformed, codeUnits, start, end);
340 if (result != null) { 340 if (result != null) {
341 return result; 341 return result;
342 } 342 }
343 343
344 int length = codeUnits.length; 344 int length = codeUnits.length;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 } 574 }
575 break loop; 575 break loop;
576 } 576 }
577 if (expectedUnits > 0) { 577 if (expectedUnits > 0) {
578 _value = value; 578 _value = value;
579 _expectedUnits = expectedUnits; 579 _expectedUnits = expectedUnits;
580 _extraUnits = extraUnits; 580 _extraUnits = extraUnits;
581 } 581 }
582 } 582 }
583 } 583 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698