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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unicode support to dotenv #7003

Merged
merged 1 commit into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion shared-module/dotenv/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ STATIC bool key_matches(file_arg *active_file, const char *key) {
// Still on tentative key; see if it matches the next supplied key character,
// but don't run off the end of the supplied key.
if (key_pos < key_len) {
matches = matches && key[key_pos] == character;
matches = matches && (unsigned char)key[key_pos] == character;
escaped = false;
key_pos++;
} else {
Expand Down
2 changes: 2 additions & 0 deletions tests/circuitpython/dotenv_test.env
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ space_after_key =value
space_after_key_before_value = value
quoted_then_comment='value'#comment
hash_with_spaces=#value value
aa馃悕bb=key with emoji
value_with_emoji=aa馃悕bb
2 changes: 2 additions & 0 deletions tests/circuitpython/dotenv_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
print(f"space_after_key_before_value={dotenv.get_key(FILE, 'space_after_key_before_value')}")
print(f"quoted_then_comment={dotenv.get_key(FILE, 'quoted_then_comment')}")
print(f"hash_with_spaces={dotenv.get_key(FILE, 'hash_with_spaces')}")
print(f"aa馃悕bb={dotenv.get_key(FILE, 'aa馃悕bb')}")
print(f"value_with_emoji={dotenv.get_key(FILE, 'value_with_emoji')}")
2 changes: 2 additions & 0 deletions tests/circuitpython/dotenv_test.py.exp
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ space_after_key=value
space_after_key_before_value=value
quoted_then_comment=value
hash_with_spaces=#value value
aa馃悕bb=key with emoji
value_with_emoji=aa馃悕bb