For the first question: keyboards send scancodes, not ASCII or Unicode.
Software on the computer then interprets the scancodes, e.g. the BIOS during boot or the operating system. E.g. in Linux scancodes and shifting state are interpreted by kernel key maps that translate keycodes to 16 bit numbers, which are normally Unicode/ASCII characters.