Page 1 of 1

It's a bug? first,last,rest in utf-8 string

Posted: Sat Jul 22, 2017 1:34 am
by qinying
> (set 'str "中文字符串")
"中文字符串"
> (first str)
"中"
> (last str) ;Should be "串"
"?
> (rest str)
"文字符串"
---------
> (set 'name "覃文运")
"覃文运"
> (first name) ;Should be "覃"
"覃文"
> (rest name) ;Should be "文运"
"运"
> (last name)
"运"

Re: It's a bug? first,last,rest in utf-8 string

Posted: Mon Jan 29, 2018 10:43 am
by gekkonier
Hi qinying, are you sure?

Im running this with UTF-8 version inside atom with plugin script (on win10, with utf-8 newLISP)

Code: Select all

(set 'str "中文字符串")
(println str)
(println (first str))
(println (last str))
(println (rest str))
(println (explode str))
The output:

Code: Select all

中文字符串
中
串
文字符串
("中" "文" "字" "符" "串")
That seems to be correct to me, isn't it?