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 bloodaxe@example.net cantguessthis displayName "Eirik Blodøks"
4fa557df-3a2e-41b1-90a8-08c09d5671a9
[zimbra@zimbra2 ~]$ zmprov ga bloodaxe@example.net | 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.

Zimbra 8 - Manage account

The e-mail account of the famous viking Eirik …. who?

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):

export LC_ALL=nb_NO.UTF-8

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.