blurstudio / hab

A application environment and launcher
GNU Lesser General Public License v3.0
25 stars 3 forks source link

[Bug]: HAB_FREEZE doesn't support unicode characters #25

Open MHendricks opened 1 year ago

MHendricks commented 1 year ago

Summary

Ensure we can encode/decode unicode characters in HAB_FREEZE.

Expected Behavior

You should be able to store unicode values in hab json files.

Steps to Reproduce Behavior

This code seems like it shows how encode_freeze and decode_freeze should be modified.

import base64
import json
in_dict = ["\U0001F389"]
data = json.dumps(in_dict)

# Encoding
data = data.encode('utf-8')
data = base64.b64encode(data)
data = data.decode("utf-8")

# Decoding
data = data.encode('ascii')
data = base64.b64decode(data)
data = data.decode('utf-8')
data = json.loads(data)

Solution

No response

Environment

All os's

Additional Context

-

MHendricks commented 1 year ago

Also ensure that unicode is supported by all of HAB. Here is a test configuration.

{
    "name": "utf8",
    "inherits": false,
    "distros": [],
    "environment": {
        "set": {
            "UTF_VALUE": "[\ud83c\udf89]",
            "ASCII_VALUE": "[ascii]"
        }
    }
}