Spruced up unicode handling for magic