Forum Navigation
Usage of tango.io.UnicodeFile
Posted: 12/04/08 12:37:52While porting some DFL examples to Tango I came across tango.io.UnicodeFile? - very nice.
I read a file like
scope uf = new UnicodeFile!(char) ("filename", Encoding.Unknown); char content[] = uf.read; Encoding encoding = uf.encoding;After that, encoding is automagically set to e.g. Encoding.UTF_8N. When writing back the file, I would like to write a UTF-BOM only if there was an UTF-BOM in the original file.
My question is: Is there an easy way to find out, whether there had been an UTF-BOM in the file? The only way I found was to compare cast (ubyte) content.length against "filename".fileSize, but this seems ugly.