Skip to content

Make unicode normalization optional - #85

Closed
elsirion wants to merge 1 commit into
rust-bitcoin:masterfrom
elsirion:2025-05-normalization
Closed

Make unicode normalization optional#85
elsirion wants to merge 1 commit into
rust-bitcoin:masterfrom
elsirion:2025-05-normalization

Conversation

@elsirion

@elsirion elsirion commented May 26, 2025

Copy link
Copy Markdown
Collaborator

Potential solution for #28 (comment)

With default features this is the dependency tree now:

bip39 v2.1.0 (/home/user/projects/elsirion/rust-bip39)
├── bitcoin_hashes v0.13.0
│   ├── bitcoin-internals v0.2.0
│   └── hex-conservative v0.1.2
├── rand v0.8.5
│   ├── libc v0.2.162
│   ├── rand_chacha v0.3.1
│   │   ├── ppv-lite86 v0.2.20
│   │   │   └── zerocopy v0.7.35
│   │   │       ├── byteorder v1.5.0
│   │   │       └── zerocopy-derive v0.7.35 (proc-macro)
│   │   │           ├── proc-macro2 v1.0.89
│   │   │           │   └── unicode-ident v1.0.13
│   │   │           ├── quote v1.0.37
│   │   │           │   └── proc-macro2 v1.0.89 (*)
│   │   │           └── syn v2.0.87
│   │   │               ├── proc-macro2 v1.0.89 (*)
│   │   │               ├── quote v1.0.37 (*)
│   │   │               └── unicode-ident v1.0.13
│   │   └── rand_core v0.6.4
│   │       └── getrandom v0.2.15
│   │           ├── cfg-if v1.0.0
│   │           └── libc v0.2.162
│   └── rand_core v0.6.4 (*)
├── rand_core v0.6.4 (*)
└── serde v1.0.214

@elsirion
elsirion force-pushed the 2025-05-normalization branch from e64a0d5 to 93330e9 Compare May 26, 2025 23:33
Comment thread Cargo.toml
Comment on lines +22 to +28
chinese-simplified = [ "unicode-normalization" ]
chinese-traditional = [ "unicode-normalization" ]
czech = []
french = []
italian = []
japanese = []
korean = []
japanese = [ "unicode-normalization" ]
korean = [ "unicode-normalization" ]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk if that's the right way to go about it, but it seems reasonable to want UN if you are dealing with these languages. I can also make it an entirely optional feature, which is cleaner but imo risks misuse.

Comment thread Cargo.toml
rand = [ "crate_rand", "rand_core" ]
alloc = [ "unicode-normalization" ]
alloc = []
unicode-normalization = [ "dep:unicode-normalization", "alloc" ]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't work in old rust

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevenroose What was the ancient Rust version we need to get it to work on? :D

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elsirion I guess we don't really need to use dep: which is somehow recent addition.

And we can have unicode-normalization-std to avoid using ?.

@elsirion

elsirion commented Jun 4, 2025

Copy link
Copy Markdown
Collaborator Author

I didn't consider the ? feature being missing in old cargo :/ I think a different approach makes more sense after talking to BlueMatt anyway.

@elsirion elsirion closed this Jun 4, 2025
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.

3 participants