Hi all, Thank you for your information.
At the last weedend, I've tried 'picolisp', 'pil', 'pil +' and the Java version, when deleting input Chinese charater, there is also an issue: input '你好' (nihao in Pinyin) first, : 你好 and then push backspace once, it will become: : 你 there is a space after '你', so only half of '好' is deleted. And after deleted the space, the start of the line is reached. So the '你' can not be deleted further. So I'm reading the source code of main.c of 32bit picolisp(the function load()). BTW, I found that using Chinese in source code (utf8) works without any problem. like this: # 星座 (client "xxx.com.cn" 80 (pack "lcsservice/constellation/getFortune?" (urlencode "key=15531CFAC1E4AAAAE9F2FF1DB09A5DEB&consName=射手座&type=tomorrow")) (out NIL (echo)) ) Zhang Enwei ________________________________ From: firstname.lastname@example.org <email@example.com> on behalf of Alexander Burger <a...@software-lab.de> Sent: Friday, January 26, 2018 3:11 PM To: firstname.lastname@example.org Subject: Re: Chinese input causes mess in the REPL Hello Zhang Enwei, > I'm studying and using PicoLisp, and trying to make it a regular dev tool in > my daily development. It's some difficult but quite interesting for me. Glad to hear that! > I found a defect about Chinese language supporting, under Mac OS X 32bit, and > Arm 64bit version(in Termux), but Java version is OK. Yes, I know :( I've observed it with Japanese (Kanji and kana) input too. > It is, for example, when I input (setq x "你好"), the REPL will display like > this: > : ((s(s(s(s(s(setq x "你好") > -> "你好" Right. It is the line editor in @lib/led.l, which cannot handle characters taking up two places on the screen. To do it correctly, it would need to output *two* backspaces, but the line editor doesn't know the width of these characters. ErsatzLisp, the Java version, does not have this problem, because it uses no line editor ;) In normal PicoLisp it is only in debug mode, because this loads the line editor. Production mode PicoLisp (i.e. started without '+') should be clean in this regard, but not very useful. > The result is OK, but the display is messy. > > I'd like to try to solve this issue, would anyone like to tell me the code > position? It is in some places, most importantly in the places in @lib/led.l where backspaces are output, of the form like (do D (prin "^H")) There is no easy fix. PicoLisp lacks the functionality to calculate the width of unicode characters. I suppose it needs some extra character tables and lookup mechanisms in the base system, or perhaps call an external C function via 'native'. Any suggestions? ♪♫ Alex -- UNSUBSCRIBE: mailto:email@example.com?subject=Unsubscribe