1. difficulty with dir()
- Posted by useless Oct 18, 2009
- 1083 views
Some time in the last 15 years, i made a directory name with a 16bit unicode char in it. I can open the file in text editors, in FF and IE, but dir() in a Eu program tells me it isn't there. This is the path in various forms:
doc_root={109m,58:,92\,80P,72H,80P,32¦,36$,95_,67C,79O,79O,75K,73I,69E,32¦,194,171,32¦,80P,72H,80P,32¦,84T,117u,116t,111o,114r,105i,97a,108l,115s,95_,102f,105i,108l,101e,115s,92\}
http://127.0.0.1:8080/m:%5CPHP%20$_COOKIE%20%C2%AB%20PHP%20Tutorials_files%5C
M:\PHP $_COOKIE « PHP Tutorials_files\
It's not a space or %xx problem, dir replies properly on those. It's the ,194,171, unicode tiney << symbol that's tripping it up, i believe.
How do i get around this?
useless
2. Re: difficulty with dir()
- Posted by CoJaBo Oct 18, 2009
- 1055 views
Theres a Windows API version of DIR in the archives: http://www.rapideuphoria.com/cgi-bin/asearch.exu?win=on&keywords=win_dir
Euphoria is one of the few remaining languages with no native support for charsets other than ASCII.
3. Re: difficulty with dir()
- Posted by useless Oct 18, 2009
- 1016 views
Still no joy. I get the same result on
listing = win_dir(doc_root & path)
as with
listing = dir(doc_root & path)
listing is set to -1. But either will work if i remove that 2-byte little << character from the directory name.
useless
4. Re: difficulty with dir()
- Posted by DerekParnell (admin) Oct 18, 2009
- 1024 views
doc_root={109m,58:,92\,80P,72H,80P,32¦,36$,95_,67C,79O,79O,75K,73I,69E,32¦,194,171,32¦,80P,72H,80P,32¦,84T,117u,116t,111o,114r,105i,97a,108l,115s,95_,102f,105i,108l,101e,115s,92\}
http://127.0.0.1:8080/m:%5CPHP%20$_COOKIE%20%C2%AB%20PHP%20Tutorials_files%5C
I'm not quite understanding something here. The Unicode value for '«' is 0xAB (171) so I've not sure what the 0xC2 value is doing in the string. That's the unicode value for 'Â'
5. Re: difficulty with dir()
- Posted by useless Oct 18, 2009
- 1003 views
doc_root={109m,58:,92\,80P,72H,80P,32¦,36$,95_,67C,79O,79O,75K,73I,69E,32¦,194,171,32¦,80P,72H,80P,32¦,84T,117u,116t,111o,114r,105i,97a,108l,115s,95_,102f,105i,108l,101e,115s,92\}
http://127.0.0.1:8080/m:%5CPHP%20$_COOKIE%20%C2%AB%20PHP%20Tutorials_files%5C
I'm not quite understanding something here. The Unicode value for '«' is 0xAB (171) so I've not sure what the 0xC2 value is doing in the string. That's the unicode value for 'Â'
Sorry, i did not name the file or the directory. I do not know what M$ windoze OS or browser it was saved with. I am merely saying a web server written in Eu stumbles all over the name when passing it to dir() or win_dir()(edited for use in Eu v4) or file_exists(). I can open the file in a browser, get properties for it in winxp file explorer, open the dir and files in TextPad. But cannot dir() it in Euphoria v4 on winxp SP2.
useless
6. Re: difficulty with dir()
- Posted by DerekParnell (admin) Oct 18, 2009
- 1031 views
Some time in the last 15 years, i made a directory name with a 16bit unicode char in it. I can open the file in text editors, in FF and IE, but dir() in a Eu program tells me it isn't there.
I just tried to do the same thing and its working fine.
I created a folder called "some « folder" and then a text file inside that called "test.data". I then wrote the following program and it works exactly as I expected it to.
include std/filesys.e object d sequence n = "c:\\temp\\some « folder" d = dir(n) for i = 1 to length(d) do printf(1, "%-40s %s\n", {d[i][D_NAME], d[i][D_ATTRIBUTES]}) if find('d', d[i][D_ATTRIBUTES]) then continue end if integer fh = open(n & '\\' & d[i][D_NAME], "r") object l integer cnt = 0 while sequence(l) with entry do cnt += 1 if l[$] = '\n' then l = l[1..$-1] end if printf(1, "%04d '%s'\n", {cnt, l}) entry l = gets(fh) end while close(fh) puts(1, "\n") end for
Output...
c:\temp>dir Volume in drive C has no label. Volume Serial Number is B872-CDD3 Directory of c:\temp 19/10/2009 09:54 AM <DIR> . 19/10/2009 09:54 AM <DIR> .. 19/10/2009 09:54 AM <DIR> Some « folder 19/10/2009 09:49 AM 527 test.ex 1 File(s) 527 bytes 3 Dir(s) 23,578,501,120 bytes free c:\temp>type test.ex include std/filesys.e object d sequence n = "c:\\temp\\some ½ folder" d = dir(n) for i = 1 to length(d) do printf(1, "%-40s %s\n", {d[i][D_NAME], d[i][D_ATTRIBUTES]}) if find('d', d[i][D_ATTRIBUTES]) then continue end if integer fh = open(n & '\\' & d[i][D_NAME], "r") object l integer cnt = 0 while sequence(l) with entry do cnt += 1 if l[$] = '\n' then l = l[1..$-1] end if printf(1, "%04d '%s'\n", {cnt, l}) entry l = gets(fh) end while close(fh) puts(1, "\n") end for c:\temp>eui test . d .. d test.data a 0001 'Line one in test data' 0002 ' another line' 0003 ' ' 0004 ' and yet another line.' 0005 '' 0006 'last line' c:\temp>
7. Re: difficulty with dir()
- Posted by DerekParnell (admin) Oct 18, 2009
- 987 views
I am merely saying a web server written in Eu stumbles all over the name when passing it to dir() or win_dir()(edited for use in Eu v4) or file_exists(). I can open the file in a browser, get properties for it in winxp file explorer, open the dir and files in TextPad. But cannot dir() it in Euphoria v4 on winxp SP2.
Where do you get the name from to pass it to dir()? Is it something you type in or does the name come another application?
What does Euphoria return from dir() as the name when you run it against the folder's parent folder?
8. Re: difficulty with dir()
- Posted by useless Oct 18, 2009
- 983 views
Some time in the last 15 years, i made a directory name with a 16bit unicode char in it. I can open the file in text editors, in FF and IE, but dir() in a Eu program tells me it isn't there.
I just tried to do the same thing and its working fine.
I created a folder called "some « folder" and then a text file inside that called "test.data". I then wrote the following program and it works exactly as I expected it to.
include std/filesys.e object d sequence n = "c:\\temp\\some « folder"
So you admit you didn't use the double-byte combo.
useless
9. Re: difficulty with dir()
- Posted by mattlewis (admin) Oct 19, 2009
- 1058 views
doc_root={109m,58:,92\,80P,72H,80P,32¦,36$,95_,67C,79O,79O,75K,73I,69E,32¦,194,171,32¦,80P,72H,80P,32¦,84T,117u,116t,111o,114r,105i,97a,108l,115s,95_,102f,105i,108l,101e,115s,92\}
http://127.0.0.1:8080/m:%5CPHP%20$_COOKIE%20%C2%AB%20PHP%20Tutorials_files%5C
I'm not quite understanding something here. The Unicode value for '«' is 0xAB (171) so I've not sure what the 0xC2 value is doing in the string. That's the unicode value for 'Â'
0xC2AB is UTF-8 for '«'. Windows normally uses UTF-16 whenever it uses unicode. However, it does not appear to be a valid UTF-16 character. But the rest of the data looks like it's probably UTF-8 as well.
So maybe there's some weird encoding issues going on. You could try wxEuphoria, which should be using UTF-16 on windows, to see what it finds. Beyond that, I'm not sure what else to suggest, as my knowledge of Unicode intricacies is pretty limited.
Matt