Repository navigation
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @caixr23. Thanks for your PR. I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The SSID decoding in AccessPointPrivate::propertiesChanged() was hardcoded to QString::fromUtf8(), which produced garbled text for SSIDs encoded with GBK/GB2312 (common in Chinese network environments). Replace the hardcoded fromUtf8 with nm_utils_ssid_to_utf8() from libnm, consistent with how nmtui decodes SSIDs. This function: 1. Validates UTF-8 and returns directly if valid 2. Falls back to locale-aware encoding detection (including GBK/GB2312 when locale is zh_CN) for non-UTF-8 SSIDs 3. Falls back to ISO-8859-1 as last resort This fixes the root cause at the source: AccessPoint::ssid() now returns correctly decoded text, and the ssidChanged signal carries the correct value. This complements the dde-network-core PR #627 which handles the display/save paths at the DDE layer. PMS: BUG-357843
1161a15 to
2907e53
Compare
|
问题不复现,中间版本已经修复了 |
Root Cause Analysis
The SSID decoding in
AccessPointPrivate::propertiesChanged()was hardcoded toQString::fromUtf8(rawSsid). For SSIDs encoded with GBK/GB2312 (common in Chinese network environments), this produced garbled text in the network list. TherawSsid(QByteArray) was stored correctly, but thessid(QString) used for display was incorrectly decoded.Key evidence:
accesspoint.cppline 199 (before fix):ssid = QString::fromUtf8(rawSsid)— hardcoded UTF-8, no fallbackAccessPoint::ssid()(returnsQString) was affected;WirelessSetting::ssid()(returnsQByteArray) was notnetworkmanager-qt6had no modifications to this code — identical to upstream KDEFix
Replace the hardcoded
QString::fromUtf8(rawSsid)withnm_utils_ssid_to_utf8()from libnm, consistent with hownmtuidecodes SSIDs:#include <libnm/NetworkManager.h>toaccesspoint.cppnm_utils_ssid_to_utf8()to decode the raw SSID bytes to a UTF-8 stringQStringviaQString::fromUtf8()and free withg_free()nm_utils_ssid_to_utf8()handles encoding detection:This is complementary to dde-network-core PR #627, which handles the display and save paths at the DDE layer. Both fixes can be merged independently.
Safety Assessment
libnmis already a REQUIRED PUBLIC dependency of networkmanager-qt6rawSsid()and other APIs are completely unaffectedTest Suggestion
ssidChangedsignal carries correct value for both encodings根因分析
AccessPointPrivate::propertiesChanged()中 SSID 解码硬编码为QString::fromUtf8(rawSsid),对 GBK/GB2312 编码的 SSID 产生乱码。修复方案
使用 libnm 的
nm_utils_ssid_to_utf8()替换硬编码的fromUtf8,与 nmtui 的 SSID 解码方式保持一致。nm_utils_ssid_to_utf8()会先验证 UTF-8,失败时根据 locale 回退到对应编码(如 zh_CN 下尝试 GBK/GB2312),最后回退 ISO-8859-1。libnm已是 networkmanager-qt6 的 REQUIRED PUBLIC 依赖,无需新增依赖。与 dde-network-core PR #627 互补,两者可分别合入。
安全评估
libnm已是现有依赖,无新增依赖