You could try encoding the name of the wifi profile. f'netsh wlan show profiles name="Leonard’s iPhone iP15" key=clear\n'.encode('utf-8') When I paste that character in to my python shell it crashes. So it could just be t hat Python does not handle that character properly and a bug report shuold be filed.