There're files that starts with BOM. When reading from those files, it seems 
all of Racket's I/O API don't know to strip the BOM, making them extremely 
difficult to work with. 

For example, Here is a UTF-8 encoded text file with BOM header. To be exact, 
here's the binary layout of the file content:

    0000000: efbb bf68 656c 6c6f 2077 6f72 6c64 210d  ...hello world!.
    0000010: 0a                                       .

Note that the first 3 bytes are BOM.

Now using the below racket program to read it:

   (define port (open-input-file #:mode 'text "test.txt"))
   (define line (read-line port))
   line

`#:mode` is optional, any choice of it doesn't make a difference.

The result is:

   "\uFEFFhello world!"

instead of

   "hello world!"

-- 
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.
hello world!

Reply via email to