microsoft / PTVS

Python Tools for Visual Studio
https://aka.ms/PTVS
Apache License 2.0
2.52k stars 673 forks source link

Every time the code in the python environment is entered, an error will be reported when the output Chinese is output #7914

Closed vsfeedback closed 4 weeks ago

vsfeedback commented 1 month ago

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work] [regression] [worked-in:17.9] 说是要加个前缀声明,但每次这样过于麻烦,而且没有效果,希望把python环境下的文件编码默认是utf-8的模式,降低新手使用vs的操作难度 SyntaxError: Non-UTF-8 code starting with '\xc4' in file D:\代码_project\PythonApplication1\PythonApplication1.py on line 4, but no encoding declared;


Original Comments

Feedback Bot on 5/19/2024, 08:12 PM:

(private comment, text removed)


Original Solutions

(no solutions)

StellaHuang95 commented 4 weeks ago

Hi there, thanks for the issue. To save in UTF-8, you can navigate to File -> Save As -> click the dropdown button next to Save, choose save with encoding -> choose UTF-8 and re-run the script? Please re-open the ticket if that doesn't answer your question, thanks!