Fixing Keyboard Layout Problems with iPhone Mirroring
If you find that the keyboard layout being used by your mirrored iPhone is not the same as what you are using on your Mac, it is most likely because the mapping in iPhone settings is not set correctly. While the phone is being mirrored go to its Settings > General > Keyboard > Hardware Keyboard and tap on the language you are using and make sure that on the list of mappings that appears you have checked the same mapping as you are using on your Mac.
If you find that you can't switch the keyboard on your phone to a different one from your Mac, try each of the standard Mac keyboard shortcuts: Control Space, Fn/Globe, and (for switching between Latin and non-Latin layouts) Caps Lock. You may need to check that these shortcuts are activated in the keyboard system settings of the Mac and and the hardware keyboard settings of the iPhone.