Zimbra 8 - provisioning accounts with non English characters using zmprov
After doing some initial testing with a bash script to migrate a few accounts from an external system to our Zimbra 8 installation, I noticed that the expected character set was not supported.
This caused every user with a displayname containing non English characters to end up as garbage. Thankfully I became aware of this problem before running the full migration as the provisioning already takes forever and a day to complete.
Trying to create an account on the fly illustrates the problem, the following commands execute these operations:
- zmprov cd = create domain
- zmprov ca = create account
- zmprov ga = get account
[zimbra@zimbra2 ~]$ zmprov cd example.net 83125ded-fda9-4262-bc4d-e38b0392fba7 [zimbra@zimbra2 ~]$ zmprov ca firstname.lastname@example.org cantguessthis displayName "Eirik Blodøks" 4fa557df-3a2e-41b1-90a8-08c09d5671a9 [zimbra@zimbra2 ~]$ zmprov ga email@example.com | grep displayName displayName: Eirik Blod��ks
The result from the provisioning process is shown on the image below. The actual screenshot is from the account management view in the Admin Console.
After checking the bash script for encoding faults, I verified the locale environment for the Zimbra user (which will be doing the actual provisioning), and as it turns out, the LANG environment variable is set to “C” (an English-only environment).
It might be tempting to edit the .bash_profile of the Zimbra user and switch to a permanent UTF-8 based character-set, but that would most likely have seriously unwanted side effects, or at least slow down the system noticeably. A simple solution is to specify a language environment for the current session only.
This can be achieved by the issuing following command (replace nb_NO with whatever locale applicable):
By issuing the locale command again, we’ll notice that the language environment has been changed. Creating the user once more with zmprov will now work as expected.