/* Test UTF-8 I/O */
proc main()
{
    var f, s, i, n, nr;
    var bof, eof;

    f = new File("INPUT/utf8a.txt", "r");
    bof = f.ftell();

    s = f.readstr();
    "s = \"", s, "\"\n";

    f.fseek(bof, io::SEEK_SET);
    s = f.readstr();
    "s = \"", s, "\"\n";

    f.rewind();
    s = f.readstr();
    "s = \"", s, "\"\n";

    f.close();

    f = new File("INPUT/utf8a.txt", "rb");
    eof = f.sizeof();
    n = Int(eof);

    s = f.read(PackUbyte[n]);

    print("Z2.2,:,1X", s);

    f.close();
}