Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - IVShilov

#31
I spent 8 hours figuring out HOW it works in windows cmd.exe and found a paradox.

Two paradoxes.

Try this by yourself, all code in this post is copy and paste from cmd.exe window.



Starts CMD.EXE, and newlisp.exe without any init.lsp, and put him a valid cyrillic filepath as first parameter:


D:tmp>r:binnewlispnewlisp.exe -n "D:tmpЁ.doc"
newLISP v.10.7.1 64-bit on Windows IPv4/6 UTF-8 libffi, options: newlisp -h

> (last (main-args))
"D:\tmp\╨╕.doc"             # two symbols - not one, it's UNICODE
> (load {R:binnewlispmodulesiconv.lsp})
MAIN
> (file? (last (main-args)))  # may be it understands as valid path?
nil
> (Iconv:convert (last (main-args)) {UTF-8} {CP866}) # OK, de-UNICODE it
"D:\tmp\и.doc"
> # one symbol, but there must be "Ё"!

After hours of en- decoding between UTF-8, CP866 and CP1251 I have lucky shot in the dark and have paradox one: UTF8-path, decoded in CP866, must be decoded as CP1251 to CP866 again:

> (Iconv:convert (Iconv:convert (last (main-args)) {UTF-8} {CP866}) {CP1251} {CP866})
"D:\tmp\Ё.doc"
> #  no logic, but now we have a readable file path!
> (file? (Iconv:convert (Iconv:convert (last (main-args)) {UTF-8} {CP866}) {CP1251} {CP866}) ) # but what about this thinks newlisp itself?
nil

Newlisp think that there is no such file, but I think it is, I see "D:\tmp\Ё.doc".

Paradox two:

> (write-file {D:tmp1.txt} {1}) # OK, newlisp, does the file you create by yourself...
1
> (file? {D:tmp1.txt}) # ... would be a truly file?
true
> (write-file {D:tmpЁ.txt} {Ё}) # OK, now special case
1
> (file? {D:tmpЁ.txt})
true
> (file? {D:tmpЁ.doc})
nil
>


Ok, explorer.exe, what do you think about that?

Ё.doc:
[attachment=1]Ё.doc.jpg[/attachment]
Ё.txt
[attachment=2]Ё.txt.jpg[/attachment]

PPL, I think only some kind of Data Flow Diagram may clearly shows whats going under the hood of GUI and where the silent charset translations take place.
[attachment=0]DFD CMD-newlisp-OS.jpg[/attachment]
As I know, CMD.EXE works in CP866, FileSystem store file paths in CP1251, and newlisp.exe internally works in UTF-8. Let's discuss
#32
Hello!

I upgrade v10.6.2 to v10.7.1 and found that it cannot start.

Tryed newlisp.exe -h and got the same error.

Using procmon.exe founded that problem is in reading old init.lsp, moving it out - newlisp starts fine.

IMHO "newlisp.exe -h" must not read init.lsp, especially because it output helps with startup problems.



Thank you for new release! If it wrong place to post such complains, point me a proper, please.