unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Matt Wette <matt.wette@gmail.com>
To: 22901@debbugs.gnu.org
Subject: bug#22901: drain-input doesn't decode
Date: Sun, 26 Feb 2017 09:46:14 -0800	[thread overview]
Message-ID: <B5C0BF5C-7316-44AA-A89C-FF3CDE0E804C@gmail.com> (raw)
In-Reply-To: <20160304030944.GA1318@fysh.org>

[-- Attachment #1: Type: text/plain, Size: 543 bytes --]

I put together a test and tried on 2.1.7 - my test fails.  See attached.

  (pass-if "encoded input"
    (let ((fn (test-file))
	  (nc "utf-8")
	  (st "\u03b2\u03b1\u03b4 \u03b1\u03c3\u03c3 am I.")
	  ;;(st "hello, world\n")
	  )
      (let ((p1 (open-output-file fn #:encoding nc)))
	;;(display st p1)
	(string-for-each (lambda (ch) (write-char ch p1)) st)
	(close p1))
      (let* ((p0 (open-input-file fn #:encoding nc))
	     (s0 (begin (unread-char (read-char p0) p0) (drain-input p0))))
	(simple-format #t "~S\n" s0)
	(equal? s0 st))))


[-- Attachment #2: port-di.test --]
[-- Type: application/octet-stream, Size: 712 bytes --]

;; port-di.text  -*- scheme -*-

(add-to-load-path "guile-2.1.7-dev3/test-suite")

(use-modules (test-suite lib))

(define (test-file)
  (string-append (getcwd) "/ports-test.tmp"))

(with-test-prefix "drain-input"
  
  (pass-if "encoded input"
    (let ((fn (test-file))
	  (nc "utf-8")
	  (st "\u03b2\u03b1\u03b4 \u03b1\u03c3\u03c3 am I.")
	  ;;(st "hello, world\n")
	  )
      (let ((p1 (open-output-file fn #:encoding nc)))
	;;(display st p1)
	(string-for-each (lambda (ch) (write-char ch p1)) st)
	(close p1))
      (let* ((p0 (open-input-file fn #:encoding nc))
	     (s0 (begin (unread-char (read-char p0) p0) (drain-input p0))))
	(simple-format #t "~S\n" s0)
	(equal? s0 st))))

  )

;; --- last line ---

  parent reply	other threads:[~2017-02-26 17:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04  3:09 bug#22901: drain-input doesn't decode Zefram
2016-06-20 16:12 ` Andy Wingo
2017-02-26 17:46 ` Matt Wette [this message]
2017-02-26 17:58   ` Matt Wette
2021-05-16 17:55 ` Taylan Kammer
2021-05-19 11:41 ` Taylan Kammer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B5C0BF5C-7316-44AA-A89C-FF3CDE0E804C@gmail.com \
    --to=matt.wette@gmail.com \
    --cc=22901@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).