OLD | NEW |
1 library inputstream; | 1 library inputstream; |
2 | 2 |
3 import 'dart:collection'; | 3 import 'dart:collection'; |
4 import 'package:utf/utf.dart'; | 4 import 'package:utf/utf.dart'; |
5 import 'package:source_span/source_span.dart'; | 5 import 'package:source_span/source_span.dart'; |
6 import 'char_encodings.dart'; | 6 import 'char_encodings.dart'; |
7 import 'constants.dart'; | 7 import 'constants.dart'; |
8 import 'utils.dart'; | 8 import 'utils.dart'; |
9 import 'encoding_parser.dart'; | 9 import 'encoding_parser.dart'; |
10 | 10 |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 /// Return the python codec name corresponding to an encoding or null if the | 309 /// Return the python codec name corresponding to an encoding or null if the |
310 /// string doesn't correspond to a valid encoding. | 310 /// string doesn't correspond to a valid encoding. |
311 String codecName(String encoding) { | 311 String codecName(String encoding) { |
312 final asciiPunctuation = new RegExp( | 312 final asciiPunctuation = new RegExp( |
313 "[\u0009-\u000D\u0020-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E]"); | 313 "[\u0009-\u000D\u0020-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E]"); |
314 | 314 |
315 if (encoding == null) return null; | 315 if (encoding == null) return null; |
316 var canonicalName = encoding.replaceAll(asciiPunctuation, '').toLowerCase(); | 316 var canonicalName = encoding.replaceAll(asciiPunctuation, '').toLowerCase(); |
317 return encodings[canonicalName]; | 317 return encodings[canonicalName]; |
318 } | 318 } |
OLD | NEW |