[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guile 2.0.9 build on mingw
From: |
Eli Zaretskii |
Subject: |
Re: guile 2.0.9 build on mingw |
Date: |
Wed, 19 Jun 2013 06:03:04 +0300 |
> From: Mark H Weaver <address@hidden>
> Cc: Eli Zaretskii <address@hidden>, address@hidden
> Date: Tue, 18 Jun 2013 18:28:13 -0400
>
> I think this is a bad idea for multiple reasons:
>
> * Handling of alternate line endings does not belong here; it belongs in
> a transcoder of some sort.
>
> * This solution partially hides a problem (the user reading text without
> a proper transcoder), but does not solve the problem adequately. It
> will behave badly on files with CRLF line endings. There's no way to
> fix that in 'read-line' because its API does not allow for a
> multi-character delimiter.
>
> * It potentially breaks existing code. Making the change only on mingw
> would seem to mitigate that problem, but that just muddies the waters
> by introducing a difference in behavior that is not necessarily
> warranted.
>
> * It hard codes the assumption that the line ending style of the file
> being read is determined by the platform you're running on.
I agree.
> To my mind, this is a bug in those tests.
Right.
> So how about the following patch instead?
>
> What do you think?
>
> Mark
>
>
> diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test
> index 9b1c6c0..758f8f6 100644
> --- a/test-suite/tests/ports.test
> +++ b/test-suite/tests/ports.test
> @@ -238,7 +238,7 @@
> (pass-if "file: binary mode ignores port encoding"
> (with-fluids ((%default-port-encoding "UTF-8"))
> (let* ((filename (test-file))
> - (port (open-file filename "w"))
> + (port (open-file filename "wb"))
> (test-string "一二三")
> (binary-test-string
> (apply string
> @@ -257,7 +257,7 @@
> (pass-if "file: binary mode ignores file coding declaration"
> (with-fluids ((%default-port-encoding "UTF-8"))
> (let* ((filename (test-file))
> - (port (open-file filename "w"))
> + (port (open-file filename "wb"))
> (test-string "一二三")
> (binary-test-string
> (apply string
I already tried that, and it doesn't work. You cannot have a port
that is both UTF-8 encoded and open in binary mode, because Guile will
try to encode characters in 8859-1, and fail (because the characters
used here are not Latin-1 characters).
IOW, binary I/O cannot be encoded.
- Re: guile 2.0.9 build on mingw, (continued)
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/16
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/13
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/17
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/18
- Re: guile 2.0.9 build on mingw, Mark H Weaver, 2013/06/18
- Re: guile 2.0.9 build on mingw,
Eli Zaretskii <=
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/19
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/19
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/18
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/19
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/19
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/13
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/16
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/16