diff --git a/shared-module/dotenv/__init__.c b/shared-module/dotenv/__init__.c index 24587247f0..be8f2353de 100644 --- a/shared-module/dotenv/__init__.c +++ b/shared-module/dotenv/__init__.c @@ -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 { diff --git a/tests/circuitpython/dotenv_test.env b/tests/circuitpython/dotenv_test.env index 7119774fa1..e3bc23d6ce 100644 --- a/tests/circuitpython/dotenv_test.env +++ b/tests/circuitpython/dotenv_test.env @@ -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 diff --git a/tests/circuitpython/dotenv_test.py b/tests/circuitpython/dotenv_test.py index 8445b98030..f217b72dbe 100644 --- a/tests/circuitpython/dotenv_test.py +++ b/tests/circuitpython/dotenv_test.py @@ -23,3 +23,5 @@ print(f"space_after_key={dotenv.get_key(FILE, 'space_after_key')}") 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')}") diff --git a/tests/circuitpython/dotenv_test.py.exp b/tests/circuitpython/dotenv_test.py.exp index d1cde70182..d67d570999 100644 --- a/tests/circuitpython/dotenv_test.py.exp +++ b/tests/circuitpython/dotenv_test.py.exp @@ -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