Unicode BOM and endianness

Derek derek at psyc.ward
Fri Aug 4 05:17:43 PDT 2006


On Fri, 04 Aug 2006 08:44:21 -0300, Tim Locke wrote:

> On Fri, 4 Aug 2006 14:15:00 +1000, Derek Parnell
> <derek at nomail.afraid.org> wrote:
> 
>>On Fri, 04 Aug 2006 00:36:21 -0300, Tim Locke wrote:
>>
>>> How do I acquire and determine the BOM and endianness of a file I am
>>> reading?
>>> 
>>> Thanks
>>
>>You might check out http://en.wikipedia.org/wiki/Byte_Order_Mark
> 
> I'm sorry but I wasn't clear in what I am looking for.
> 
> I'm looking to be able to open a file and have D automatically tell me
> which format it is, e.g. UTF-8, UTF-16LE, UTF-16BE, etc. without my
> having to code it. Ideally I would like to be able to read any unicode
> or ascii file and have D automatically detect its type and allow me to
> read it into whatever format I want, such as char, wchar, dchar.

The phobos library supplied by Walter does not have this functionality. The
mango library and maybe others do. I know that I had to code this myself
when I needed it.

-- 
Derek Parnell
Melbourne, Australia
"Down with mediocrity!"



More information about the Digitalmars-d-learn mailing list