InputEventKey auto-converting to uppercase

Godot Version

v4.2.2.stable.official [15073afe3]

Question

I am making a typing game using gdscript. A bit of a newbie, so bear with me. I used a tutorial I saw (converted it to v4 from v3), and used most of the code there. If I do the code below, it always gives me the uppercase version of the key, despite caps lock not being on or not pressing shift. Is this normal behavior? Is there a way for me to get the lowercase version of the key?

if event is InputEventKey and not event.is_pressed():
     var typed_event = event as InputEventKey
     var key_typed = PackedByteArray([typed_event.get_keycode_with_modifiers()]).get_string_from_utf8()
     print(key_typed)

I’m new also making little projects , so please understand if I interpreted this wrong.

If you use a line edit I know you can use get_to_lower to convert all to lower case in engine and opposite for get_to_upper. If you need to change between upper and lowercase , I believe you could just check for a " == " input and look at the input from that.

@onready var line_input = $LineEdit

func check_typing():
    var current_array = ["example", "test", "hello"] # Assuming current_array is defined somewhere
    var typed_text = line_input.text.strip_edges() # Get the text from the LineEdit and remove leading/trailing spaces
    
    if current_array.has(typed_text):
        print("Test worked!")
    else:
        print("Something's wrong")

In Godot 4 you can simply use typed_event.as_text_keycode().

Calling get_keycode_with_modifiers() will correctly return the Latin keycode combined with those modifier keys. However, since you plug that value as a single byte into a PackedByteArray and a single byte can only hold values between 0 and 255 (inclusive) that originally correct information gets lost in the implicit cast.

You can always call the to_lower function (on any string).