hi, I was hoping yesterday to read UTF-16 characters from a file using, e.g., a small snippet such as the following:
(for ([c (in-port read-char (open-input-file "myfile.txt"))] [counter naturals] #:break (>= counter 100)) (printf "(~a [~a]) " c (char->integer c))) For a UFT-16 file (that came from windows and perhaps for that reason has a byte order mark -- not sure) that be begins "11 Nov" I got: (� [65533]) (� [65533]) (1 [49]) ( [0]) (1 [49]) ( [0]) ( [32]) ( [0]) (N [78]) ( [0]) (o [111]) ( [0]) (v [118]) ( [0]) I suspect I need to do something with encodings, but I wasn't able to figure it out with a quick scan through documentation and searches in this group. Perhaps someone could give me a quick nudge in the right direction? Cheers, Tim p.s. maybe there's an easier way to get an arbitrary counter than what i did here? (define (integers-starting-from n) (stream-cons n (integers-starting-from (+ n 1)))) (define naturals (integers-starting-from 1)) This worked fine for me, so I didn't worry about it... -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.