Creating sparse files for loopback images can be done with the dd command. The ascii_only strips all non-ascii characters out of a string.