Comment 0 for bug 1061150

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

The python-glanceclient chokes on unicode for image names, metadata keys, and metadata values.

Examples:
# unicode in name
$ MERC=$(echo -e "\u263f")
$ echo $MERC

$ glance image-create --name Freddy-$MERC
'ascii' codec can't decode byte 0xe2 in position 30: ordinal not in range(128)

$ BB=$(echo -e "\u2047")
$ CC=$(echo -e "\u2048")
$ echo $BB

$ echo $CC

# unicode in metadata value
$ glance image-update --property ascii_key=unicode-${BB} 7a40d9d3-ee1d-48a1-8e2a-6c8ae01b7b4c
'ascii' codec can't decode byte 0xe2 in position 45: ordinal not in range(128)

# unicode in metadata key
$ glance image-update --property unicode_key_${CC}=ascii-value 7a40d9d3-ee1d-48a1-8e2a-6c8ae01b7b4c
'ascii' codec can't decode byte 0xe2 in position 38: ordinal not in range(128)

NOTE: The glance API can handle unicode fine:
$ VAL=$(echo -e "\u2645")
$ KEY=$(echo -e "\u262e")
$ echo $VAL

$ echo $KEY

curl -X PUT \
  -H "User-Agent: curl-by-hand" \
  -H "X-Auth-Token: $AUTH_TOKEN" \
  -H "x-image-meta-name: unicode-$VAL" \
  -H "x-image-meta-property-$KEY: the-key-is-unicode" \
  -H "x-image-meta-property-unicode_value: my-$VAL" \
 http://50.57.98.195:9292/v1/images/7a40d9d3-ee1d-48a1-8e2a-6c8ae01b7b4c

{
    "image": {
        "checksum": "9490463a2a6db02c08fbe9016e168ca4",
        "container_format": "ami",
        "created_at": "2012-10-01T18:23:14",
        "deleted": false,
        "deleted_at": null,
        "disk_format": "ami",
        "id": "7a40d9d3-ee1d-48a1-8e2a-6c8ae01b7b4c",
        "is_public": false,
        "min_disk": 0,
        "min_ram": 0,
        "name": "unicode-\u2645",
        "owner": "637807f80e43444c9676abc18100838c",
        "properties": {
            "unicode_value": "my-\u2645",
            "\u262e": "the-key-is-unicode"
        },
        "protected": false,
        "size": 25165824,
        "status": "active",
        "updated_at": "2012-10-03T18:22:27"
    }
}