[1289] 导出样式文件/包宏名称使用 utf8->herk 修复中文乱码 - #4530
Open
da-liii wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
描述
打开标题或文件名是中文的 .tmu 文件时,使用「工具 → 宏命令 → 导出样式包」或「导出样式文件」新建的标签头部宏名称会出现乱码。
根因
extract-source-title中通过(url-basename (current-buffer))获得的文件名为原始 UTF-8 字符串,而内部文档树排版要求文本节点使用 Herk 编码(中文为<#XXXX>转义)。未转换的原始 UTF-8 字节直接拼入文档树导致头部被当作单字节字符渲染出现乱码。解决
在
extract-source-title中使用(utf8->herk (url-basename (current-buffer))),确保生成的宏名称符合 Herk 编码契约。