diff --git a/TeXmacs/tests/tmu/69_5.tmu b/TeXmacs/tests/tmu/69_5.tmu new file mode 100644 index 0000000000000000000000000000000000000000..93f950441e33826ef7a1905be3bc56af53862fad --- /dev/null +++ b/TeXmacs/tests/tmu/69_5.tmu @@ -0,0 +1,28 @@ +> + +> + +<\body> + + + +<\initial> + <\collection> + + + + + +<\references> + <\collection> + > + + + +<\auxiliary> + <\collection> + <\associate|parts> + + + + diff --git "a/TeXmacs/tests/tmu/69_5_\346\265\213\350\257\225.tmu" "b/TeXmacs/tests/tmu/69_5_\346\265\213\350\257\225.tmu" new file mode 100644 index 0000000000000000000000000000000000000000..8b88beb827fccc30c3f23882657e0079254299a6 --- /dev/null +++ "b/TeXmacs/tests/tmu/69_5_\346\265\213\350\257\225.tmu" @@ -0,0 +1,8 @@ +> + +<\body> + ABCDabcd科科科 + + + +> diff --git "a/TeXmacs/tests/tmu/69_5_\350\257\264\346\230\216.tmu" "b/TeXmacs/tests/tmu/69_5_\350\257\264\346\230\216.tmu" new file mode 100644 index 0000000000000000000000000000000000000000..061312ebc52201991cc12bcab8e540554f289579 --- /dev/null +++ "b/TeXmacs/tests/tmu/69_5_\350\257\264\346\230\216.tmu" @@ -0,0 +1,31 @@ +> + +> + +<\body> + + + + + <\itemize> + Reporter: Darcy + + Owner: Darcy + + Tester: Darcy + + + + + See . The filename to include contains Chinese, it should be in cork encoding like the normal Chinese text once included. When we change the filename in the focus toolbar, its encoding will be changed into cork encoding. But the inclusion failed to work. + + + + + + +<\initial> + <\collection> + + + diff --git a/devel/69_5.md b/devel/69_5.md new file mode 100644 index 0000000000000000000000000000000000000000..2eb49cc9de027c7cc0cf96897571b4f03f3174c2 --- /dev/null +++ b/devel/69_5.md @@ -0,0 +1,29 @@ +# 69_5: 修复链接插入包含文件功能时不支持中文的问题 + +## 2023/11/21 + +### What + +这个 PR 修复了 include 路径在 Unicode 环境下的兼容性问题,确保了多语言文件路径可以被正确包含和处理。 + +### Why + +- 主要是为了解决文件包含(include)路径的 Unicode 处理问题。 +- 原有实现中,include 路径直接使用字符串,可能导致在包含含有 Unicode 字符(如中文、日文等)的文件路径时,路径解析或文件查找失败。 +- 通过增加 utf8->cork 和 cork_to_utf8 的转换,确保路径在不同编码环境下都能被正确识别和处理,提升了对 Unicode 路径的兼容性。 + +### How + +- 在 generic-edit.scm 文件修改了`make-include`的实现,将原本的``(insert `('include ,(url->delta-unix u)))``改为``(insert `('include ,(utf8->cork (url->delta-unix u))))`` +- 在 env_exec.cpp 文件中在处理`VAR_INCLUDE`的 case 时,将`url file_name= url_unix (exec_string (t[0]))`改为`url file_name= url_unix (cork_to_utf8 (exec_string (t[0])));` + +### Result + +现在可以正确 include 含有 Unicode 字符的文件路径,不会因为编码问题导致 include 失败。 +这对于中文等多语言环境下的用户尤其重要,提升了软件的国际化和易用性。 + +### Links + +https://github.com/XmacsLabs/mogan/pull/1351/commits/2d2649f98f6616e6f2e4fa6d87dee028f1ffb80f + +整理时间:2025/7/7 \ No newline at end of file