Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set LANG and LOCALE_ARCHIVE for nix shell #2719

Merged
merged 2 commits into from
May 26, 2021

Conversation

mkoura
Copy link
Contributor

@mkoura mkoura commented May 20, 2021

Set correct locale env variables in nix so cardano-cli ran from nix-shell works as expected.

Without proper locale settings, e.g. multi-assets with unicode chars in asset name don't work:

$ cardano-cli transaction build-raw --fee 0 --out-file test_minting_unicode_asset_name_mint_estimate_tx.body --tx-in 2eaa1408eb5a4388ffa82d2c3f378dc2edb7c471a44ccfdf6bfeea4b54d0e858#0 --tx-out "addr_test1vzazmulffx974jaxjn3kv76kdew4kxr99tw4v5kad50xq7sfjytzv+900000000+5 7c7861c4b99224819818b335eb61c97e3bbec777aece7f1563d920bf.ěůřščžďťňkszw" --mint "5 7c7861c4b99224819818b335eb61c97e3bbec777aece7f1563d920bf.ěůřščžďťňkszw" --minting-script-file test_minting_unicode_asset_name.script
option --tx-out: 
           unexpected "\56516"
           expecting alphanumeric asset name
...

With correct locale there's no issue:

$ cardano-cli transaction build-raw --fee 191769 --out-file test_minting_unicode_asset_name_mint_tx.body --tx-in ff6a1d797d27e4408a293e5b2985556095afc8a28686e0d6ae403af962093098#0 --tx-out "addr_test1vrktl4mg8w83dl8untnmn99maz4yz4sjkk8m5jqay0xzgfq9jwrw6+899808231+5 e48c26399203edda32b52d52fd7c4d3566f350a037efbff00aedf883.ěůřščžďťňdxjk" --mint "5 e48c26399203edda32b52d52fd7c4d3566f350a037efbff00aedf883.ěůřščžďťňdxjk" --minting-script-file test_minting_unicode_asset_name.script

$ cardano-cli query utxo --address addr_test1vrktl4mg8w83dl8untnmn99maz4yz4sjkk8m5jqay0xzgfq9jwrw6 --out-file /dev/stdout --testnet-magic 42 --cardano-mode
{
    "96003f81df15b6d26f62a88d83b31ca9670bcfec4ea82ce739777ff20409e1fd#0": {
        "address": "addr_test1vrktl4mg8w83dl8untnmn99maz4yz4sjkk8m5jqay0xzgfq9jwrw6",
        "value": {
            "e48c26399203edda32b52d52fd7c4d3566f350a037efbff00aedf883": {
                "ěůřščžďťňdxjk": 5
            },
            "lovelace": 899808231
        }
    }
}

@mkoura mkoura requested a review from deepfire May 20, 2021 12:16
shell.nix Outdated Show resolved Hide resolved
shell.nix Outdated Show resolved Hide resolved
@rvl
Copy link
Contributor

rvl commented May 20, 2021

Just noting that from your examples, it appears to me that cardano-cli is working correctly w.r.t. unicode.
If the user's character encoding is ASCII, then all characters >= 0x80 are rejected as non-alphanumeric.

But if test cases use the UTF-8 encoding for unicode characters, then this shell.nix change is necessary to force a UTF-8 locale in the shell.

Adding @rvl suggestions

Co-authored-by: Rodney Lorrimar <dev@rodney.id.au>
@rvl
Copy link
Contributor

rvl commented May 26, 2021

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 26, 2021

@iohk-bors iohk-bors bot merged commit f9c9fa4 into IntersectMBO:master May 26, 2021
@mkoura mkoura deleted the nix_locale branch May 26, 2021 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants