problem with default UTF8 not UTF-8

JustaGuy

Renowned Member
Jan 1, 2010
324
2
83
I have an open ticket with my email provider after discovering I wasn't able to search the message body on reports generated by vzdump.

It was determined to be due to a missing hyphen in the message header, which prevents the message from being indexed.
Code:
Content-Type: text/plain;
        charset="UTF8"
I see that the host's locale is set to UTF8 not UTF-8
Code:
# locale -a
C
POSIX
en_US.utf8
This post details a procedure to change the locale.
I'm hesitant to do that after reading on the net about how utf8 could be a required by perl.

I'd like to know if making the change is advised before I do anything, in case there are unseen implications to doing so.

Code:
# pveversion -v
pve-manager: 1.6-5 (pve-manager/1.6/5261)
running kernel: 2.6.35-1-pve
proxmox-ve-2.6.35: 1.6-7
pve-kernel-2.6.32-4-pve: 2.6.32-25
pve-kernel-2.6.35-1-pve: 2.6.35-7
qemu-server: 1.1-25
pve-firmware: 1.0-9
libpve-storage-perl: 1.0-14
vncterm: 0.9-2
vzctl: 3.0.24-1pve4
vzdump: 1.2-8
vzprocps: 2.0.11-1dso2
vzquota: 3.0.11-1
pve-qemu-kvm: 0.13.0-2
ksm-control-daemon: 1.0-4
 
Today I checked on /etc/locale.gen, and confirmed the line that's not commented indeed is correct:
Code:
en_US.UTF-8 UTF-8

And I ran the procedure to update the locale:
Code:
# locale-gen
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.

And still the system locale is UTF8, without the hyphen:
Code:
# locale -a
C
POSIX
en_US.utf8
 
I know this is old but I think I figured out whats happening. I'll bet if you did a locale command without the -a you would see that all your locales are set to POSIX and not en_US.UTF-8. I had the same problem in a openVZ container and did this to fix it.

Code:
[COLOR=#484848]export LANGUAGE=en_US.UTF-8
[/COLOR][COLOR=#484848]export LANG=en_US.UTF-8
[/COLOR][COLOR=#484848]export LC_ALL=en_US.UTF-8
[/COLOR][COLOR=#484848]locale-gen en_US.UTF-8 [/COLOR][COLOR=#484848]
[/COLOR][COLOR=#484848]dpkg-reconfigure locales
[/COLOR]

This moved the POSIX entry below the en-US.UTF-8 one in the list and made it work for me. It still says utf8 without the dash if I use just the plain locale command but locale -a gives the correct information