Charles Hixson wrote:
> I want to read a bunch of files, and if the aren't UTF, then I want to
> list their names for conversion, or other processing.  How should this
> be handled??
> 
> try..catch..finally blocks just ignore this error.

> type stuff.d
import std.stdio;
import std.utf;

void main()
{
    try
    {
        writefln("A B \xfe C");
    }
    catch( UtfException e )
    {
        writefln("I caught a %s!", e);
    }
}

> dmd stuff && stuff
A B I caught a 4invalid UTF-8 sequence!

Works for me.

Reply via email to