Date: Tue, 18 Oct 2022 15:17:49 +0800 From: =?UTF-8?B?5ZCz5oGp57ev?= <rickywu0421@gmail.com> To: freebsd-hackers@freebsd.org Subject: Re: ifconfig(8) IEEE802.11 SSID format Message-ID: <CAM71UgdAx2s2JfLV=ujrq7CWJgW%2BYznr8nbURg=tTX09hL%2B1Qw@mail.gmail.com> In-Reply-To: <CAM71UgdWKY_zeY-p14CpV2Tc%2BRuzWsorgcZxXmmhk8u15rOKig@mail.gmail.com> References: <CAM71UgdWKY_zeY-p14CpV2Tc%2BRuzWsorgcZxXmmhk8u15rOKig@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--00000000000085ee1c05eb49e467 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sorry for not explaining the whole situation. The previous email was asking for everyone about how to solve the problem explained in it, and I also introduced a way to deal with it, which may or may not be adopted. =E5=90=B3=E6=81=A9=E7=B7=AF <rickywu0421@gmail.com> =E6=96=BC 2022=E5=B9=B4= 10=E6=9C=8818=E6=97=A5 =E9=80=B1=E4=BA=8C =E4=B8=8A=E5=8D=8811:25=E5=AF=AB= =E9=81=93=EF=BC=9A > Currently `ifconfig wlanX scan` will show SSID in hex when the scanned > SSID is non-printable. And the non-printable character is when the > character with value < 32 or value >=3D 126 in ifconfig(8)'s implementati= on. > That leads to a problem that other languages using UTF-8 or other encodin= g > will be treated as non-printable in ifconfig(8), thus not printed on > screen. > > Here is the possible way to solve the problem: > When a SSID is going to be printed, copy the byte stream (uint8_t *) into > wide character stream (wchar_t *), and use libc iswprint(3) to check > whether characters are printable or non-printable. I have tested this and > it is workable when the locale is correctly set. > --00000000000085ee1c05eb49e467 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Sorry for not explaining the whole situation.<div><br></di= v><div>The previous email was asking for everyone about how to solve the pr= oblem explained in it, and I also introduced a way to deal with it, which m= ay or may not be adopted.</div></div><br><div class=3D"gmail_quote"><div di= r=3D"ltr" class=3D"gmail_attr">=E5=90=B3=E6=81=A9=E7=B7=AF <<a href=3D"m= ailto:rickywu0421@gmail.com">rickywu0421@gmail.com</a>> =E6=96=BC 2022= =E5=B9=B410=E6=9C=8818=E6=97=A5 =E9=80=B1=E4=BA=8C =E4=B8=8A=E5=8D=8811:25= =E5=AF=AB=E9=81=93=EF=BC=9A<br></div><blockquote class=3D"gmail_quote" styl= e=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid= ;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Curr= ently `ifconfig wlanX=C2=A0scan` will show SSID in hex when the scanned SSI= D is non-printable. And the non-printable character is when the character w= ith value < 32 or value >=3D 126 in ifconfig(8)'s implementation.= That leads to a problem that other languages using UTF-8 or other encoding= will be treated as non-printable in ifconfig(8), thus not printed on scree= n.=C2=A0<div><br></div><div>Here is the possible way to solve the problem:<= /div><div>When a SSID is going to be printed, copy the byte stream (uint8_t= *) into wide character stream (wchar_t *), and use libc iswprint(3) to che= ck whether characters are printable or non-printable. I have tested this an= d it is workable when the locale is correctly set.</div></div> </blockquote></div> --00000000000085ee1c05eb49e467--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAM71UgdAx2s2JfLV=ujrq7CWJgW%2BYznr8nbURg=tTX09hL%2B1Qw>