Improved unicode handling