generate_key
Description:
Generates a collation key for str, the result of comparing two collation keys with 
      strcmp will be the same result of calling 
      collate on the same original strings.
This function will first ensure that str is valid UTF-8 encoded.
Parameters:
| this | 
           An Collator  | 
      
| str | 
           The string to generate a collation key for  | 
      
Returns:
| 
           A collation key for   |