Skip to content

Commit ee28658

Browse files
authored
Merge pull request #7003 from jepler/dotenv-emoji
Add unicode support to dotenv
2 parents 8b6fff2 + 27e6623 commit ee28658

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

shared-module/dotenv/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ STATIC bool key_matches(file_arg *active_file, const char *key) {
124124
// Still on tentative key; see if it matches the next supplied key character,
125125
// but don't run off the end of the supplied key.
126126
if (key_pos < key_len) {
127-
matches = matches && key[key_pos] == character;
127+
matches = matches && (unsigned char)key[key_pos] == character;
128128
escaped = false;
129129
key_pos++;
130130
} else {

tests/circuitpython/dotenv_test.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ space_after_key =value
2121
space_after_key_before_value = value
2222
quoted_then_comment='value'#comment
2323
hash_with_spaces=#value value
24+
aa🐍bb=key with emoji
25+
value_with_emoji=aa🐍bb

tests/circuitpython/dotenv_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@
2323
print(f"space_after_key_before_value={dotenv.get_key(FILE, 'space_after_key_before_value')}")
2424
print(f"quoted_then_comment={dotenv.get_key(FILE, 'quoted_then_comment')}")
2525
print(f"hash_with_spaces={dotenv.get_key(FILE, 'hash_with_spaces')}")
26+
print(f"aa🐍bb={dotenv.get_key(FILE, 'aa🐍bb')}")
27+
print(f"value_with_emoji={dotenv.get_key(FILE, 'value_with_emoji')}")

tests/circuitpython/dotenv_test.py.exp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ space_after_key=value
1919
space_after_key_before_value=value
2020
quoted_then_comment=value
2121
hash_with_spaces=#value value
22+
aa🐍bb=key with emoji
23+
value_with_emoji=aa🐍bb

0 commit comments

Comments
 (0)