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

For the Compleat Fan

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

Postby qinying » Sat Jul 22, 2017 1:34 am

> (set 'str "中文字符串")
"中文字符串"
> (first str)
"中"
> (last str) ;Should be "串"
"?
> (rest str)
"文字符串"
---------
> (set 'name "覃文运")
"覃文运"
> (first name) ;Should be "覃"
"覃文"
> (rest name) ;Should be "文运"
"运"
> (last name)
"运"
qinying
 
Posts: 7
Joined: Sun Jul 16, 2017 11:12 am

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

Postby gekkonier » Mon Jan 29, 2018 10:43 am

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?
gekkonier
 
Posts: 14
Joined: Fri Jan 26, 2018 7:44 pm


Return to Anything else we might add?

Who is online

Users browsing this forum: No registered users and 3 guests

cron