From e16d0986c200a476ab5dae6ef9e4a2defcc4ef58 Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 7 Jul 2025 16:15:44 +0800 Subject: [PATCH 1/2] 69_5 --- TeXmacs/tests/tmu/69_5.tmu | 28 +++++++++++++++++ .../tmu/69_5_\346\265\213\350\257\225.tmu" | 8 +++++ .../tmu/69_5_\350\257\264\346\230\216.tmu" | 31 +++++++++++++++++++ devel/69_5.md | 29 +++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 TeXmacs/tests/tmu/69_5.tmu create mode 100644 "TeXmacs/tests/tmu/69_5_\346\265\213\350\257\225.tmu" create mode 100644 "TeXmacs/tests/tmu/69_5_\350\257\264\346\230\216.tmu" create mode 100644 devel/69_5.md diff --git a/TeXmacs/tests/tmu/69_5.tmu b/TeXmacs/tests/tmu/69_5.tmu new file mode 100644 index 000000000..93f950441 --- /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 000000000..8b88beb82 --- /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 000000000..061312ebc --- /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 000000000..384ae6fc4 --- /dev/null +++ b/devel/69_5.md @@ -0,0 +1,29 @@ +# 69_5: 在将字符串转为 url 之前,先做 s8ork_to_utf8 的转换 + +## 2023/11/21 + +### What + +这个 PR 修复了 include 路径在 Unicode 环境下的兼容性问题,确保了多语言文件路径可以被正确包含和处理。 + +### Why + +- 主要是为了解决文件包含(include)路径的 Unicode 处理问题。 +- 原有实现中,include 路径直接使用字符串,可能导致在包含含有 Unicode 字符(如中文、日文等)的文件路径时,路径解析或文件查找失败。 +- 通过增加 utf8->s8okr 和 s8ork_to_utf8 的转换,确保路径在不同编码环境下都能被正确识别和处理,提升了对 Unicode 路径的兼容性。 + +### How + +- 在 generic-edit.scm 文件修改了`make-include`的实现,将原本的`(insert `('include ,(url->delta-unix u)))`改为`(insert `('include ,(utf8->s8okr (url->delta-unix u))))` +- 在 env_exec.cpp 文件中在处理`VAR_INCLUDE`的 case 时,将`url file_name= url_unix (exec_string (t[0]))`改为`url file_name= url_unix (s8ork_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 -- Gitee From 7d61101f0297644d6d3a189e12d6ac85e68a1f55 Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 7 Jul 2025 16:33:34 +0800 Subject: [PATCH 2/2] 1 --- devel/69_5.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/devel/69_5.md b/devel/69_5.md index 384ae6fc4..2eb49cc9d 100644 --- a/devel/69_5.md +++ b/devel/69_5.md @@ -1,4 +1,4 @@ -# 69_5: 在将字符串转为 url 之前,先做 s8ork_to_utf8 的转换 +# 69_5: 修复链接插入包含文件功能时不支持中文的问题 ## 2023/11/21 @@ -10,12 +10,12 @@ - 主要是为了解决文件包含(include)路径的 Unicode 处理问题。 - 原有实现中,include 路径直接使用字符串,可能导致在包含含有 Unicode 字符(如中文、日文等)的文件路径时,路径解析或文件查找失败。 -- 通过增加 utf8->s8okr 和 s8ork_to_utf8 的转换,确保路径在不同编码环境下都能被正确识别和处理,提升了对 Unicode 路径的兼容性。 +- 通过增加 utf8->cork 和 cork_to_utf8 的转换,确保路径在不同编码环境下都能被正确识别和处理,提升了对 Unicode 路径的兼容性。 ### How -- 在 generic-edit.scm 文件修改了`make-include`的实现,将原本的`(insert `('include ,(url->delta-unix u)))`改为`(insert `('include ,(utf8->s8okr (url->delta-unix u))))` -- 在 env_exec.cpp 文件中在处理`VAR_INCLUDE`的 case 时,将`url file_name= url_unix (exec_string (t[0]))`改为`url file_name= url_unix (s8ork_to_utf8 (exec_string (t[0])));` +- 在 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 -- Gitee