[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: byte-order marks
From: |
Neil Jerram |
Subject: |
Re: byte-order marks |
Date: |
Tue, 29 Jan 2013 19:22:43 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
Andy Wingo <address@hidden> writes:
> What do people think about this attached patch?
>
> Andy
>
>
>>From 831c3418941f2d643f91e3076ef9458f700a2c59 Mon Sep 17 00:00:00 2001
> From: Andy Wingo <address@hidden>
> Date: Mon, 28 Jan 2013 22:41:34 +0100
> Subject: [PATCH] detect and consume byte-order marks for textual ports
In case an example is of any help for this discussion, here's some code
that I wrote to consume a possible BOM on contacts data downloaded from
Google:
(define (read-csv file-name)
(let ((s (utf16->string (get-bytevector-all (open-input-file file-name))
'little)))
;; Discard possible byte order mark.
(if (and (>= (string-length s) 1)
(char=? (string-ref s 0) #\xfeff))
(set! s (substring s 1)))
...))
I wonder if I chose to use utf16->string because there wasn't - at that
time - a way of handling the BOM without slurping into a string first?
However it was a long time ago now so I really can't be sure what the
context was.
Regards,
Neil
- Re: byte-order marks, (continued)
- Re: byte-order marks, Ludovic Courtès, 2013/01/29
- Re: byte-order marks, Ludovic Courtès, 2013/01/29
- Re: byte-order marks, Andy Wingo, 2013/01/30
- Re: byte-order marks, Ludovic Courtès, 2013/01/30
- Re: byte-order marks, Andy Wingo, 2013/01/31
- [PATCHES] Discard BOMs at stream start for UTF-{8,16,32} encodings, Mark H Weaver, 2013/01/30
- Re: [PATCHES] Discard BOMs at stream start for UTF-{8,16,32} encodings, Andy Wingo, 2013/01/31
- Re: [PATCHES] Discard BOMs at stream start for UTF-{8,16,32} encodings, Andy Wingo, 2013/01/31
- Re: [PATCHES] Discard BOMs at stream start for UTF-{8, 16, 32} encodings, Mark H Weaver, 2013/01/31
- Re: [PATCHES] Discard BOMs at stream start for UTF-{8, 16, 32} encodings, Ludovic Courtès, 2013/01/31
Re: byte-order marks,
Neil Jerram <=