VS2015 'utf-8' codec can't decode byte

时间:2023-01-04 20:11:15

近日装好Visual Studio 2015 和PTVS准备练习Python开发,遇到一个棘手的问题,编码错误,提示如下:

SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xd3 in position 2: 
invalid continuation byte

有一种临时的解决方案,File-->Advanced Save Options-->Utf-8 without signature 。

可以解决当前文件运行报错问题。

VS2015 'utf-8' codec can't decode byte

Improvements for 2.2.2

The following significant issues have been resolved:

  • Fixed incompatibilities with Visual Studio 2015 Update 1

  • #712 Don't add Unicode BOM by default

  • #664 Profiler does not handle UTF-8 BOM

  • #810 Referencing multiple extension modules does not work

  • #926 Cannot open file when coding comment does not match actual encoding

所以,上官网下载最新版本的PTVS基本上就可以解决问题了。