[libvirt] [PATCH] esx: Explictly declare VMX file content as UTF-8
Matthias Bolte
matthias.bolte at googlemail.com
Fri Oct 15 18:45:04 UTC 2010
2010/10/14 Daniel Veillard <veillard at redhat.com>:
> On Thu, Oct 14, 2010 at 08:59:18AM +0200, Matthias Bolte wrote:
>> ---
>> src/esx/esx_vmx.c | 3 +++
>> tests/xml2vmxdata/xml2vmx-annotation.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-cdrom-ide-device.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-cdrom-ide-file.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-cdrom-scsi-device.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-cdrom-scsi-file.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-esx-in-the-wild-2.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-esx-in-the-wild-3.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-ethernet-bridged.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-ethernet-custom.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-ethernet-e1000.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-ethernet-generated.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-ethernet-other.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-ethernet-static.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-ethernet-vmxnet2.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-ethernet-vpx.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-floppy-device.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-floppy-file.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-graphics-vnc.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-1.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-2.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-3.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-4.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-harddisk-ide-file.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-harddisk-scsi-file.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-minimal-64bit.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-minimal.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-parallel-device.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-parallel-file.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-scsi-driver.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-scsi-writethrough.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-serial-device.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-serial-file.vmx | 1 +
>> .../xml2vmxdata/xml2vmx-serial-network-client.vmx | 1 +
>> .../xml2vmxdata/xml2vmx-serial-network-server.vmx | 1 +
>> tests/xml2vmxdata/xml2vmx-serial-pipe.vmx | 1 +
>> 38 files changed, 40 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
>> index e17e1e7..7dc8e60 100644
>> --- a/src/esx/esx_vmx.c
>> +++ b/src/esx/esx_vmx.c
>> @@ -2475,6 +2475,9 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
>> return NULL;
>> }
>>
>> + /* vmx:.encoding */
>> + virBufferAddLit(&buffer, ".encoding = \"UTF-8\"\n");
>> +
>> /* vmx:config.version */
>> virBufferAddLit(&buffer, "config.version = \"8\"\n");
>>
>
> Good idea ! Nice that they though about the need for an encoding there,
>
> ACK
>
> Now the question is do we check for encoding when reading a vmx ?
> Some iconv (or maybe we can reuse libxml2 conversion functions) might
> be in order.
>
> Daniel
We currently assume that VMX files are UTF-8 encoded (that's true for
ESX, at least I didn't find a counter example yet), but for example a
Windows based GSX server uses Windows-1252 encoding by default. This
is denoted as .encoding = "windows-1252" in the VMX file.
I'm working on it.
Thanks, pushed.
Matthias
More information about the libvir-list
mailing list