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

FreeSlave via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 22 04:09:34 PDT 2014


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

By ANSI do you mean Windows code pages? Text editors usually use 
some heuristics (statistical analysis for example) to determine 
encoding of file. Note that these methods are not always 
accurate, so you need to provide ability to choose other encoding 
for users.


More information about the Digitalmars-d-learn mailing list