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

Side by Side Diff: sdk/lib/io/string_transformer.dart

Issue 1194883002: Improve the encoding/decoding to/from system encoding on Windows (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Addressed review comments from lrn@ Created 5 years, 6 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 | « runtime/bin/utils_win.cc ('k') | tests/standalone/io/system_encoding_test.dart » ('j') | 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.io; 5 part of dart.io;
6 6
7 /// The current system encoding. 7 /// The current system encoding.
8 ///
9 /// This us used for converting from bytes to/from String when
10 /// communicating on stdin, stdout and stderr.
11 ///
12 /// On Windows this will use the currently active code page for the
13 /// conversion. On all other systems it will always use UTF-8.
8 const SystemEncoding SYSTEM_ENCODING = const SystemEncoding(); 14 const SystemEncoding SYSTEM_ENCODING = const SystemEncoding();
9 15
10 /** 16 /**
11 * The system encoding is the current code page on Windows and UTF-8 on 17 * The system encoding is the current code page on Windows and UTF-8 on
12 * Linux and Mac. 18 * Linux and Mac.
13 */ 19 */
14 class SystemEncoding extends Encoding { 20 class SystemEncoding extends Encoding {
15 const SystemEncoding(); 21 const SystemEncoding();
16 22
17 String get name => 'system'; 23 String get name => 'system';
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 _WindowsCodePageDecoderSink(this._sink); 127 _WindowsCodePageDecoderSink(this._sink);
122 128
123 void close() { 129 void close() {
124 _sink.close(); 130 _sink.close();
125 } 131 }
126 132
127 void add(List<int> bytes) { 133 void add(List<int> bytes) {
128 _sink.add(_WindowsCodePageDecoder._decodeBytes(bytes)); 134 _sink.add(_WindowsCodePageDecoder._decodeBytes(bytes));
129 } 135 }
130 } 136 }
OLDNEW
« no previous file with comments | « runtime/bin/utils_win.cc ('k') | tests/standalone/io/system_encoding_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698