May 04, 2004 Re: utf and std.file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | "Carlos Santander B." <carlos8294@msn.com> wrote in message news:c766k4$3ad$1@digitaldaemon.com... > Walter, did you do any changes to the compiler for 0.86 regarding UTF? Because now I ran the same code but on WinXP Pro (previously it was in Win98) and it works just well. I'm gonna test it again tomorrow on 98 to see > if it's the OS. I don't think so. |
May 04, 2004 Re: utf and std.file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <newshound@digitalmars.com> wrote in message news:c775i2$1jo3$1@digitaldaemon.com... > > "Carlos Santander B." <carlos8294@msn.com> wrote in message news:c766k4$3ad$1@digitaldaemon.com... > > Walter, did you do any changes to the compiler for 0.86 regarding UTF? Because now I ran the same code but on WinXP Pro (previously it was in Win98) and it works just well. I'm gonna test it again tomorrow on 98 to > see > > if it's the OS. I think Stewart Gordon put the finger on the problem. Filenames are used as part of the name mangling, and so need to contain valid identifier characters. |
May 04, 2004 Re: utf and std.file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | In article <c78kcm$p7n$3@digitaldaemon.com>, Walter says... > > >"Walter" <newshound@digitalmars.com> wrote in message news:c775i2$1jo3$1@digitaldaemon.com... > >I think Stewart Gordon put the finger on the problem. Filenames are used as part of the name mangling, and so need to contain valid identifier characters. > > That's not the problem. I can create "año.d", and compile and link it without an itch (in both WinXP and 98). ------------------- Carlos Santander B. |
May 04, 2004 std.utf.validate (was Re: utf and std.file) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | In article <c775i2$1jo3$1@digitaldaemon.com>, Walter says... > > >"Carlos Santander B." <carlos8294@msn.com> wrote in message news:c766k4$3ad$1@digitaldaemon.com... >> Walter, did you do any changes to the compiler for 0.86 regarding UTF? Because now I ran the same code but on WinXP Pro (previously it was in Win98) and it works just well. I'm gonna test it again tomorrow on 98 to >see >> if it's the OS. > >I don't think so. > > It must be. Like I said, it passed on XP, but it didn't pass on 98. The real problem, like I said, is that std.utf.validate("áéíóúÚÓÍÉÁÑñ") throws an UTFError, but it doesn't happen on XP (haven't tried on Linux). Since it doesn't seem to be a Phobos bug, is there something that can be done to fix that? ------------------- Carlos Santander B. |
May 07, 2004 Re: std.utf.validate (was Re: utf and std.file) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | "Carlos Santander B." <Carlos_member@pathlink.com> wrote in message news:c78qhg$141i$1@digitaldaemon.com... > In article <c775i2$1jo3$1@digitaldaemon.com>, Walter says... > > > > > >"Carlos Santander B." <carlos8294@msn.com> wrote in message news:c766k4$3ad$1@digitaldaemon.com... > >> Walter, did you do any changes to the compiler for 0.86 regarding UTF? Because now I ran the same code but on WinXP Pro (previously it was in Win98) and it works just well. I'm gonna test it again tomorrow on 98 to > >see > >> if it's the OS. > > > >I don't think so. > > > > > > It must be. Like I said, it passed on XP, but it didn't pass on 98. > > The real problem, like I said, is that std.utf.validate("áéíóúÚÓÍÉÁÑñ") throws > an UTFError, but it doesn't happen on XP (haven't tried on Linux). Since it > doesn't seem to be a Phobos bug, is there something that can be done to fix > that? Is the string you're passing to validate in UTF-8 format? |
May 09, 2004 Re: std.utf.validate (was Re: utf and std.file) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <newshound@digitalmars.com> wrote in message news:c7fgtd$2g2b$1@digitaldaemon.com | "Carlos Santander B." <Carlos_member@pathlink.com> wrote in message | news:c78qhg$141i$1@digitaldaemon.com... || It must be. Like I said, it passed on XP, but it didn't pass on 98. || || The real problem, like I said, is that std.utf.validate("áéíóúÚÓÍÉÁÑñ") | throws || an UTFError, but it doesn't happen on XP (haven't tried on Linux). Since | it || doesn't seem to be a Phobos bug, is there something that can be done to | fix || that? | | Is the string you're passing to validate in UTF-8 format? My bad there. std.utf.validate("áéíóúÚÓÍÉÁÑñ") throws "invalid UTF-8 sequence" when the file is not in UTF-8 format. However, like I've said before, if a file is named "á", I get its name (with listdir) and pass it to validate, it fails on Win98. I just thought of something else: could it be the file system? My XP is running on NTFS, but at work, 98 is on FAT32. Could that be, instead? ----------------------- Carlos Santander Bernal |
May 11, 2004 lost (was Re: std.utf.validate (was Re: utf and std.file)) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | I'm really lost about this thing. There are only 2 things I can think of that are causing the problem: the OS (XP vs 98) and the filesystem (NTFS vs FAT32). The following file compiles and runs perfectly fine on WinXP Pro, saved either as 8-bit or any kind of Unicode. //------------------------- import std.file; import std.c.stdio; import std.path; import std.utf; void main() { char [][] archivos = listdir( curdir ) ; foreach ( char [] a ; archivos ) { try validate(a); catch (UtfError) { printf("%.*s: inválido\n",a); continue; } if (isfile(a)) printf("%.*s: %d\n",a, read(a).length); } } //------------------------- That is, it outputs the size of every file in the current directory without any complain. On Win98, the same happens only if the file is saved as some Unicode flavor. If saved as 8-bit, it prints "invalid" for any file containing an accented character or anything like that. Now, I really don't understand how in this particular case, the format of the file affects the outcome. I tried to test the same on Linux, but since listdir doesn't seem to work there, I haven't been able to do it. I don't know where the problem is, but I know it's a annoying. ----------------------- Carlos Santander Bernal |
May 19, 2004 Re: lost (was Re: std.utf.validate (was Re: utf and std.file)) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | "Carlos Santander B." <carlos8294@msn.com> wrote in message news:c7pd5l$1ohk$1@digitaldaemon.com... > I'm really lost about this thing. There are only 2 things I can think of > that are causing the problem: the OS (XP vs 98) and the filesystem (NTFS vs > FAT32). > The following file compiles and runs perfectly fine on WinXP Pro, saved > either as 8-bit or any kind of Unicode. > > //------------------------- > import std.file; > import std.c.stdio; > import std.path; > import std.utf; > > void main() { > char [][] archivos = listdir( curdir ) ; > foreach ( char [] a ; archivos ) { > try > validate(a); > catch (UtfError) { > printf("%.*s: inválido\n",a); > continue; > } > if (isfile(a)) > printf("%.*s: %d\n",a, read(a).length); > } > } > //------------------------- > > That is, it outputs the size of every file in the current directory without > any complain. > On Win98, the same happens only if the file is saved as some Unicode flavor. > If saved as 8-bit, it prints "invalid" for any file containing an accented character or anything like that. Now, I really don't understand how in this > particular case, the format of the file affects the outcome. > I tried to test the same on Linux, but since listdir doesn't seem to work > there, I haven't been able to do it. > I don't know where the problem is, but I know it's a annoying. The problem is that Win98 does not support unicode, *unless* the unicode can be translated into the current code page. You can see this happening in std.file.isfile(), it calls std.file.toMBSz(). That relies on WideCharToMultiByte(), a Win32 API function with limited functionality under Win9x. |
May 20, 2004 Re: lost (was Re: std.utf.validate (was Re: utf and std.file)) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <newshound@digitalmars.com> escribió en el mensaje news:c8f5n8$167q$1@digitaldaemon.com | The problem is that Win98 does not support unicode, *unless* the unicode can | be translated into the current code page. You can see this happening in | std.file.isfile(), it calls std.file.toMBSz(). That relies on | WideCharToMultiByte(), a Win32 API function with limited functionality under | Win9x. So what's the solution? Write this in every program that uses std.file (pseudo-code, btw): if (OS.type == "win9x") printf("sorry, can't be run here. get nt,2k,xp,2k3,etc.\n"); ? That just doesn't make sense to me. What about modifying Phobos so things like this don't happen? ----------------------- Carlos Santander Bernal |
May 20, 2004 Re: lost (was Re: std.utf.validate (was Re: utf and std.file)) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | "Carlos Santander B." <carlos8294@msn.com> wrote in message news:c8h3f5$1coh$1@digitaldaemon.com... > "Walter" <newshound@digitalmars.com> escribió en el mensaje > news:c8f5n8$167q$1@digitaldaemon.com > | The problem is that Win98 does not support unicode, *unless* the unicode > can > | be translated into the current code page. You can see this happening in > | std.file.isfile(), it calls std.file.toMBSz(). That relies on > | WideCharToMultiByte(), a Win32 API function with limited functionality > under > | Win9x. > > So what's the solution? Write this in every program that uses std.file > (pseudo-code, btw): > > if (OS.type == "win9x") > printf("sorry, can't be run here. get nt,2k,xp,2k3,etc.\n"); > > ? > That just doesn't make sense to me. What about modifying Phobos so things > like this don't happen? It will work on win9x if the unicode characters you're using are representable in the system code page you've set on win9x. |
Copyright © 1999-2021 by the D Language Foundation