about (directory)
Posted: Sun Jul 16, 2017 1:11 pm
The Chinese file name cannot be displayed correctly.on my win7-64-bit computer.
it's a bug?
it's a bug?
Friends and Fans of newLISP
http://www.newlispfanclub.alh.net/forum/
http://www.newlispfanclub.alh.net/forum/viewtopic.php?f=5&t=4890
Code: Select all
(define str->bytes (lambda (s) (unpack (dup "b" (length s)) s)))
(str->bytes "the real filename")
(str->bytes "the filename directory returns")
Code: Select all
> (define str->bytes (lambda (s) (unpack (dup "b" (length s)) s)))
(lambda (s) (unpack (dup "b" (length s)) s))
> (directory)
("." ".." "guiserver" "index.html" "newlisp.exe" "鏂板缓鏂囨湰鏂囨。.txt")
> (str->bytes "新建文本文档")
(208 194 189 168 206 196 177 190 206 196 181 181)
> (str->bytes "鏂板缓鏂囨湰鏂囨。")
(230 150 176 229 187 186 230 150 135 230 156 172 230 150 135 230 161 163)
Code: Select all
(set-locale)
Code: Select all
> (set-locale)
("Chinese (Simplified)_People's Republic of China.936" ".")
Code: Select all
> (length "新建文本文档")
18
> (unpack (dup "b" 18) "新建文本文档")
(230 150 176 229 187 186 230 150 135 230 156 172 230 150 135 230 161 163)
Code: Select all
> (length "鏂板缓鏂囨湰鏂囨。")
27
> (unpack (dup "b" 27) "鏂板缓鏂囨湰鏂囨。")
(233 143 130 230 157 191 231 188 147 233 143 130 229 155 168 230 185 176 233 143 130 229 155 168 227 128 130)
Code: Select all
> (set-locale)
("en_AU.UTF-8" ".")
Code: Select all
newLISP v.10.7.2 64-bit on Windows IPv4/6 libffi, options: newlisp -h
> (set-locale)
("C" ".")
> (directory)
("." ".." "newlisp.exe" "\208\194\189\168\206\196\177\190\206\196\181\181.txt")
> (println (last (directory)))
新建文本文档.txt
"\208\194\189\168\206\196\177\190\206\196\181\181.txt"
> (append-file (last (directory)) "中文可以吗?")
12
> (read-file (last (directory)))
"\214\208\206\196\191\201\210\212\194\240\163\191"
> (println (read-file (last (directory))))
中文可以吗?
"\214\208\206\196\191\201\210\212\194\240\163\191"
Code: Select all
> (set-locale "Chinese (Simplified)_People's Republic of China.936" ".")
("Chinese (Simplified)_People's Republic of China.936" ".")
> (directory)
("." ".." "newlisp.exe" "新建文本文档.txt")
> (println (read-file (last (directory))))
中文可以吗?
"中文可以吗?"
Can only handle Chinese directory and file names,TedWalther wrote:Does that mean the non-UTF8 version of newlisp is working for you?