Repository: youtube-dl
Issue: "OSError: Failed to write string" // Bilibili // Windows 7 x64 // Python 3.6.1
Labels: cant-reproduce

- [x] I've **verified** and **I assure** that I'm running youtube-dl **2018.03.26.1**
- [x] I have at least skimmed through the [README](https://github.com/rg3/youtube-dl/blob/master/README.md), **most notably** the [FAQ](https://github.com/rg3/youtube-dl#faq) and [BUGS](https://github.com/rg3/youtube-dl#bugs) sections
- [x] I have [Searched](https://github.com/rg3/youtube-dl/search?type=Issues) the bugtracker for similar issues including closed ones
- [x] I have checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

### What is the purpose of your *issue*?
- [x] I'm filing a bug report (encountered problems with youtube-dl)

### Log
```
G:\[T] == TORRENTS COMPLETE ==>youtube-dl --verbose https://www.bilibili.com/video/av19673092/
[debug] System config: []
[debug] User config: ['-o', 'G:/DOWNLOADED/%(title)s.%(ext)s', '-f', 'bestvideo[height<=?1080][vcodec!=?vp9][ext=mp4]+bestaudio[ext=m4a]/best[height<=?1080][ext
=mp4]/best', '--merge-output-format', 'mkv']
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://www.bilibili.com/video/av19673092/']
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] youtube-dl version 2018.03.26.1
[debug] Python version 3.6.1 (CPython) - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg N-65476-ge18d9d9, ffprobe N-65476-ge18d9d9, phantomjs 2.1.1
[debug] Proxy map: {}
[BiliBili] 19673092: Downloading webpage
[BiliBili] 19673092: Downloading video info page
Traceback (most recent call last):
  File "e:\python3\3.6.1x64\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "e:\python3\3.6.1x64\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Python3\3.6.1x64\Scripts\youtube-dl.exe\__main__.py", line 9, in <module>
  File "e:\python3\3.6.1x64\lib\site-packages\youtube_dl\__init__.py", line 471, in main
    _real_main(argv)
  File "e:\python3\3.6.1x64\lib\site-packages\youtube_dl\__init__.py", line 461, in _real_main
    retcode = ydl.download(all_urls)
  File "e:\python3\3.6.1x64\lib\site-packages\youtube_dl\YoutubeDL.py", line 1989, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "e:\python3\3.6.1x64\lib\site-packages\youtube_dl\YoutubeDL.py", line 796, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "e:\python3\3.6.1x64\lib\site-packages\youtube_dl\YoutubeDL.py", line 892, in process_ie_result
    self.to_screen('[download] Downloading playlist: %s' % playlist)
  File "e:\python3\3.6.1x64\lib\site-packages\youtube_dl\YoutubeDL.py", line 495, in to_screen
    return self.to_stdout(message, skip_eol, check_quiet=True)
  File "e:\python3\3.6.1x64\lib\site-packages\youtube_dl\YoutubeDL.py", line 509, in to_stdout
    self._write_string(output, self._screen_file)
  File "e:\python3\3.6.1x64\lib\site-packages\youtube_dl\YoutubeDL.py", line 498, in _write_string
    write_string(s, out=out, encoding=self.params.get('encoding'))
  File "e:\python3\3.6.1x64\lib\site-packages\youtube_dl\utils.py", line 1408, in write_string
    if _windows_write_string(s, out):
  File "e:\python3\3.6.1x64\lib\site-packages\youtube_dl\utils.py", line 1392, in _windows_write_string
    raise OSError('Failed to write string')
OSError: Failed to write string
```
---
I feel that no further description is necessary. I can otherwise download from other sources just fine -- only Bilibili seems to have this issue. I was also unable to find "OSError" or "failed to write string" in conjunction w/ Bilibili anywhere in the issues.