vs 法语口音的输出和 matplotlib 之间的代码编码冲突

问题描述 投票:0回答:1

当我使用 utf-8 或 Latin-1 作为 .py 文件前缀时,我总是在 OUTPUT 或 matplotlib 图形文本中得到错误的字符。

在:

`# -*- coding: utf-8 -*-`
print('à')

出:

matplotlib文本以utf-8编码右显示 >

在:

`# -*- coding: Latin-1 -*-`
print('à')

出:

à

Latin-1 错误显示的 matplotlib 文本 >

我尝试了不同的编码,但我从未得到正确的输出

python matplotlib visual-studio-code character-encoding
1个回答
0
投票

谢谢约瑟夫Z。

我到处都采用UTF-8。

print('\xc3\xa0')
就是解决方案。

print('à'.encode('utf-8'))
查找代码。

我有更好的配置 matplotlib 的解决方案,我会接受。

© www.soinside.com 2019 - 2024. All rights reserved.