idf.py 打印汉字总是带上菱形问号

joy586210
Posts: 5
Joined: Tue Sep 26, 2023 5:25 am

idf.py 打印汉字总是带上菱形问号

Postby joy586210 » Tue Sep 26, 2023 5:35 am

idf.py 打印日志中汉字的总是带上菱形问号,如下所示:

I (615) wifi:security: WPA2-PSK, phy: bgn, rssi: -42
I (615) wifi:pm start, type: 1

I (615) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
I (625) wifi:AP's beacon interval = 102400 us, DTIM period = 2
I (1035) wifi:<ba-add>idx:0 (ifx:0, 20:76:93:46:9b:be), tid:0, ssn:0, winSize:64
I (1635) esp_netif_handlers: sta ip: 192.168.123.130, mask: 255.255.255.0, gw: 192.168.123.1
I (1635) TEST_ESP32: Got IP: 192.168.123.130
I (1635) TEST_ESP32: set event group.
Socket ���创���建���成���功Socket ���创���建���成���功I (1645) SERVICE: ���绑���定���成���功
I (1645) CLIENT: ���连���接���成���功
I (1645) SERVICE: ���监���听���成���功
I (1645) CLIENT: ���退���出
I (1655) SERVICE: ���准���备accept

尝试把当前的代码页调整为utf-8/eng也是一样的结果,win10环境,默认代码页gbk,
也没有什么大的影响,就是看着不舒服...
请问怎么调整idf.py以避免此问题呢?

ESP_Penguin_Helper
Posts: 156
Joined: Tue Jul 11, 2023 6:55 am

Re: idf.py 打印汉字总是带上菱形问号

Postby ESP_Penguin_Helper » Thu Sep 28, 2023 7:28 am

你在 hello_world 示例里面尝试一下,打印中文依然会出现这样的情况吗?按理说是不会显示乱码的。

如果你在终端运行

Code: Select all

chcp 65001
将活动代码页换成 UTF-8呢?

joy586210
Posts: 5
Joined: Tue Sep 26, 2023 5:25 am

Re: idf.py 打印汉字总是带上菱形问号

Postby joy586210 » Thu Sep 28, 2023 1:51 pm

chcp 65001 的结果也是一样的,和默认的 936一样的,有点奇怪了:

I (288) sleep: Configure to isolate all GPIO pins in sleep state
I (295) sleep: Enable automatic switching of GPIO sleep configuration
I (302) app_start: Starting scheduler on CPU0
I (307) app_start: Starting scheduler on CPU1
I (307) main_task: Started on CPU0
I (317) main_task: Calling app_main()
Hello world!
���欢���迎!
This is esp32s3 chip with 2 CPU core(s), WiFi/BLE, silicon revision v0.1, 2MB external flash
Minimum free heap size: 390184 bytes
Restarting in 10 seconds...
Restarting in 9 seconds...
Restarting in 8 seconds...
Restarting in 7 seconds...

ESP_Penguin_Helper
Posts: 156
Joined: Tue Jul 11, 2023 6:55 am

Re: idf.py 打印汉字总是带上菱形问号

Postby ESP_Penguin_Helper » Sat Oct 07, 2023 6:08 am

可以发一下你的代码吗(删除 build 文件)?我在我的 IDF 环境下试试。

Who is online

Users browsing this forum: No registered users and 26 guests