Chinese texts in Scheme

(kbd-map
(:mode in-text?)
(“y a o /” “姚期智”)) ;; Chinese Computer scientist

The above keybinding does not insert the his Chinese name. Why?

I have found more things that does not work. For example, in a Scheme session, the code

(define x “你好”)

does not work. Because I do
(string-length x)
will return zero. Strange.

For key binding, we should use the cork-encoding.

For string-length, it works for me. But the length is not correct.

Alternatively, you may use tmstring-length. It will compute what you expected.

I will look deeper into this.

我觉得我弄明白了: Texmacs 好像只接受 Unicode 编码来输入中文

(kbd-map (:mode in-text?)
      ("y a o /" "<#59DA><#671F><#667A>"))  ; "姚期智"

可行. 打开一个 Scheme session

(define x "姚期智")
x   ;; 这样会得到 Unicode 编码 "<#59DA><#671F><#667A>"

新版的 Texmacs 好像修复了这个东西.

English Translation of the above text

I have figured out that TeXmacs used Unicode number to process Chinese characters.

(kbd-map (:mode in-text?)
      ("y a o /" "<#59DA><#671F><#667A>"))  ; "姚期智"

works. Open a Scheme session

(define x "姚期智")
x   ;; this will give Unicode "<#59DA><#671F><#667A>"

New version of TeXmacs seems to have already fixed this.

Not exactly.
I mentioned about inserting unicode string in my talk AT USTC last year.

Here is the key point:

(kbd-map ("u s t c" (insert "中国科学技术大学")))
1 Like