We are using a docx file for a template and are calling the API for variables like first/last name etc. As we are working with a client who has a lot of contacts with special characters in their names (ñ, é etc.) we noticed that those aren't displayed correctly if called directly with first_name or last_name, however they ARE correctly displayed if we create a custom field in which we write the first and last name values and then instead call the custom fields. Any idea why this could be happening? And is there a way to call the values directly with the characters displaying correctly? Our solution is quite cumbersome. Thank you for help in advance!

1 Answer 1


It may be because of the civicrm_contact table and it's fields are not in utf8mb4_unicode_ci collation!

The Uh-oh extension can help highlight weird db issues for you, and cv api3 System.utf8conversion can convert all your tables to utf8mb4

  • Hi thanks for your reply! I've checked and the civicrm_contact table is correctly in utf8mb4_unicode_ci collation. Only the civi_rule tables are in utf8_general_ci which I'd assume wouldn't affect the contact table. The extension you mentioned is quite helpfull regardless, thanks for that. Any other idea what might cause my issue with the special characters?
    – jrock
    Apr 22, 2022 at 12:35
  • can you see the collation for first_name and custom field column of the table? Apr 22, 2022 at 12:48
  • They are both the same collation...utf8mb4_unicode_ci. It's a mystery to me why one (custom field) will display the characters correctly and the other (first_name, etc.) won't.
    – jrock
    Apr 28, 2022 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.