Added UTF-8 compatibility to single-line algorithm.