Index: sdk/lib/convert/latin1.dart |
diff --git a/sdk/lib/convert/latin1.dart b/sdk/lib/convert/latin1.dart |
index 033f8dd6e5093730a8e635c1c753d011dc0bfc55..bfc12a7e8ec607c0151cada6fc1797756f353e31 100644 |
--- a/sdk/lib/convert/latin1.dart |
+++ b/sdk/lib/convert/latin1.dart |
@@ -125,13 +125,22 @@ class _Latin1DecoderSink extends ByteConversionSinkBase { |
void _addSliceToSink(List<int> source, int start, int end, bool isLast) { |
// If _sink was a UTF-16 conversion sink, just add the slice directly with |
// _sink.addSlice(source, start, end, isLast). |
- // The code below is an incredibly stupid workaround until a real |
+ // The code below is an moderately stupid workaround until a real |
// solution can be made. |
- _sink.add(new String.fromCharCodes(source.getRange(start, end))); |
+ if (start == 0 && end == source.length) { |
+ _sink.add(new String.fromCharCodes(source)); |
+ } else { |
+ _sink.add(new String.fromCharCodes(source.sublist(start, end))); |
+ } |
if (isLast) close(); |
} |
void addSlice(List<int> source, int start, int end, bool isLast) { |
+ // If Uint8List, just add dircetly. |
+ if (source is Uint8List) { |
+ _addSliceToSink(source, start, end, isLast); |
+ return; |
+ } |
if (start < 0 || start > source.length) { |
throw new RangeError.range(start, 0, source.length); |
} |