Using wchar was bad. New version uses a function to detect if the character is unicode