[racket] line and column numbers lost after (relocate-input-port )
Hello,
Here is a piece of code that essentially shows my problem:
#lang racket
(define port (open-input-file "anyfile.txt"))
(port-count-lines! port)
(let-values (((line col pos) (port-next-location port)))
(printf "before: ~a ~a ~a\n" line col pos)
(set! port (relocate-input-port
(reencode-input-port port "cp1251")
line col pos)))
;; (port-count-lines! port) ;; does not change anything
(let-values (((line col pos) (port-next-location port)))
(printf "after: ~a ~a ~a\n" line col pos))
Output:
before: 1 0 1
after: #f #f 1
So the position is still there (good), but the
line/column numbers are lost (bad). What did I miss?
Best regards,
Dmitry