当项目文件夹名称同时包含英文和中文时,DSH无法选择其作为工作区 #4648
Replies: 2 comments 1 reply
|
This is the same defect as #4624, seen from the outside: the native picker truncates the path, so The cause is a one-line one. The picker locates the string's NUL terminator by testing only the low byte of each UTF-16LE code unit, but a terminator is a whole code unit — so any character encoded That is why it looks like "mixed English and Chinese breaks it": what actually matters is whether the name happens to contain a character whose low byte is zero. A path of purely Chinese characters that all have non-zero low bytes works fine, which makes the pattern look stranger than it is. Fix: while (end + 1 < bytes.length && bytes.readUInt16LE(end) !== 0) end += 2Reproduced and verified against the reported paths. Details, plus why the package's existing Chinese test coverage could not have caught this, are on #4624. |
|
@nokkies 已经把根因和补丁给全了,我只补一件他那条没写、但你现在最需要的:在官方修好之前,怎么把工作区加上。 先把结论用中文说一遍,因为规则和直觉不一样: 不是"中英混合不行",也不是"中文不行",而是名字里含 判断方法很简单:看这个字的 Unicode 码点,末两位是不是 所以 今天就能用的三个绕过办法:
如果换了名字还是加不上,那就不是这个 bug,值得单独贴出报错原文和后端日志——这个社区有一类问题的表现是"点了没反应/加不上"而后端其实返回了完整错误、只是前端没显示出来。 跟进的话去 #4624 或 #4654,那两边已经核到源码行、给了补丁,并且统计出这是同一家族的第约 10 份报告。 利益相关:我维护一个第三方 DSH 插件(Pi 生态兼容层)。目录选择器是 DSH 自家组件,我们既不碰也修不了,上面全是转述已核证的结论 + 可操作的绕过。 |

This is the same defect as #4624, seen from the outside: the native picker truncates the path, so
realpaththen failsENOENTand the folder cannot be added.The cause is a one-line one. The picker locates the string's NUL terminator by testing only the low byte of each UTF-16LE code unit, but a terminator is a whole code unit — so any character encoded
00 xxreads as the end of the string. U+4E00一is00 4E; U+5F00开is00 5F.That is why it looks like "mixed English and Chinese breaks it": what actually matters is whether the name happens to contain a character whose low byte is zero. A path of purely Chinese characters that all have non-zero low bytes works fine, which makes the pattern…