Added an alternative function for getting character codes from UTF-8 strings.