How to know whether a file's encoding is ansi or utf8?

2014-07-22 Thread Sam Hu via Digitalmars-d-learn
Greetings! As subjected,how can I know whether a file is in UTF8 encoding or ansi? Thanks for the help in advance. Regards, Sam

Re: How to know whether a file's encoding is ansi or utf8?

2014-07-22 Thread Sam Hu via Digitalmars-d-learn
On Tuesday, 22 July 2014 at 09:50:00 UTC, Sam Hu wrote: Greetings! As subjected,how can I know whether a file is in UTF8 encoding or ansi? Thanks for the help in advance. Regards, Sam Sorry,I mean by by code,for example,when I try to read a file content and printed to a text control in

Re: How to know whether a file's encoding is ansi or utf8?

2014-07-22 Thread Sam Hu via Digitalmars-d-learn
On Tuesday, 22 July 2014 at 11:59:34 UTC, Alexandre wrote: Read the BOM ? module main; import std.stdio; enum Encoding { UTF7, UTF8, UTF32, Unicode, BigEndianUnicode, ASCII }; Encoding GetFileEncoding(string fileName) { import std.file;