-
Notifications
You must be signed in to change notification settings - Fork 114
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
env var name CAN be any unicode char, not just ASCII #378
env var name CAN be any unicode char, not just ASCII #378
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
9e29e87
to
ae077b5
Compare
Signed-off-by: Nicolas De Loof <[email protected]>
ae077b5
to
71293bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
From Open Group Base Spec:
Environment variable names used by the utilities in the Shell and Utilities volume of POSIX.1-2017 consist solely of uppercase letters, digits, and the ( '_' ) from the characters defined in Portable Character Set and do not begin with a digit. Other characters may be permitted by an implementation; applications shall tolerate the presence of such names.
N.B. "Portable character set" is a subset of ASCII-encodable characters
So, much like we also accept other characters (.
, -
), don't see any reason to not allow full Unicode!
"a": "b", | ||
"a[1]": "c", | ||
"a.propertyKey": "d", | ||
"árvíztűrő-TÜKÖRFÚRÓGÉP": "ÁRVÍZTŰRŐ-tükörfúrógép", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed opportunity for an emoji in a test case 🤌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh boo, we still check to see if it's considered a letter:
failed to read /Users/milas/dev/repro/unicode/.env: line 1: unexpected character "😂" in variable name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but also...
$ docker compose run echo
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=5fadb26ba525
TERM=xterm
😂=1
HOME=/root
surprise! we do something different for env vars in YAML 🙈
services:
echo:
environment:
- "😂=1"
image: alpine
command: env
While there's POSIX docs about supported formats, we should align with
so we have to relax the rule... |
Agreed re: aligning with I think it's more of a warning that lots of those tools were built in the 70s and don't have any concept of UTF-8 😬 But regardless, totally fine -- at the end of the day, if you pass Unicode env var names to your Compose service and it can't handle that...don't do that? 🤷🏻 |
make godotenv use runes, not
byte
to process dot env text file, so we support unicode in variable namescloses #277