(path, binary=True, enc='utf-8')
| 330 | # Throws OSError |
| 331 | @errorfix_win |
| 332 | def read_file_unicode(path, binary=True, enc='utf-8'): |
| 333 | if not binary: |
| 334 | if six.PY2: |
| 335 | with open(path, 'r') as f: |
| 336 | return library.python.strings.to_unicode(f.read(), enc) |
| 337 | else: |
| 338 | with open(path, 'r', encoding=enc) as f: |
| 339 | return f.read() |
| 340 | # codecs.open is always binary |
| 341 | with codecs.open(path, 'r', encoding=enc, errors=library.python.strings.ENCODING_ERRORS_POLICY) as f: |
| 342 | return f.read() |
| 343 | |
| 344 | |
| 345 | @errorfix_win |