codebude / QRCoder

A pure C# Open Source QR Code implementation
MIT License
4.46k stars 1.09k forks source link

Wifi generater has a bug #440

Closed szniewenqiang closed 1 year ago

szniewenqiang commented 1 year ago

Type of issue

[1] iphone can't join the wifi after scan the QR code generated by QRCoder [2] The QRCoder generate the content is :"WIFI:T:WPA;S:WifiName;P:"123456789";;" [3] The right content is : "WIFI:T:WPA;S:WifiName;P:123456789;;"

codebude commented 1 year ago

It's not a bug, it's a feature. ;-) The WiFi payload can handle clear text and hex-formatted passwords. Passwords in HEX format have to be escaped, by wrapping them between double quotes. By default QRCoder checks the password and if the password string is in HEX format, it adds the double quotes. Unfortunately iOS struggles with this format. To avoid adding the quotes automatically, just set the escapeHexStrings parameter of the WiFi PayloadGenerator to false as explained in the documentation: https://github.com/codebude/QRCoder/wiki/Advanced-usage---Payload-generators#321-wifi