shithub: mc

ref: 9543bdfe516ddde6d347bffed6a99c9ec5c0c40b
dir: /test/encodechar.myr/

View raw version
/* checks that we can decode and encode characters from a utf8 string. */
use std

const main = {args : byte[:][:]
	chartypes()
}

const chartypes = {
	var s
	var foo
	var buf : byte[32]

	s = "1世界äa\n"
	for c : std.bychar(s)
		foo = c
		if std.encode(buf[:std.charlen(c)], c) == 0
			std.write(1, "couldn't encode\n")
		;;
		std.write(1, buf[:std.charlen(c)])
	;;
}