line_profiler
line_profiler copied to clipboard
fix encoding error
UnicodeEncodeError
will be raised if there are non-ansi characters(e.g. CJK) in the code.
This PR will solve this problem by encoding codes with UTF-8.
The stream might have a different encoding. If the stream is sys.stdout
, then it might have an .encoding
attribute that can be inspected to find this out. UTF-8 cannot be assumed.
@rkern Is this PR ready to be merged?