Reading and writing Unicode files
Daniel Keep
daniel.keep.lists at gmail.com
Sat Feb 28 21:53:37 PST 2009
jicman wrote:
> Ok, the only reason that I say Unicode is that when I open the file in Notepad and I do a SaveAs, the Encoding says Unicode. So, when i read this file and I write it back to the another file, the Encoding turns to UTF8. I want to keep it as Unicode.
There is no such thing as a Unicode file format. There just isn't. I
know the option you speak of, and I have no idea what it's supposed to
be; probably UCS-2 or UTF-16.
> I will give the suggestion a try. I did not try it yet. Maybe Phobos should think about taking care of the BOM byte and provide support for these encodings. I am a big fan of Phobos. :-) I have not tried Tango yet, because I would have to uninstall Phobos and I have just spend two years using Phobos and we already have an application based in Phobos and changing back to Tango will slow us down and put us back. Maybe version 2.0.
There's std.stream.EndianStream, which looks like it can read and write
BOMs. As for converting between UTF encodings, std.utf.
-- Daniel
More information about the Digitalmars-d-learn
mailing list