From nobody Tue Oct 18 07:17:49 2022 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ms4vc66kRz4gHV4 for ; Tue, 18 Oct 2022 07:18:04 +0000 (UTC) (envelope-from rickywu0421@gmail.com) Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ms4vb5LKQz3knf for ; Tue, 18 Oct 2022 07:18:03 +0000 (UTC) (envelope-from rickywu0421@gmail.com) Received: by mail-io1-xd2f.google.com with SMTP id b79so10891360iof.5 for ; Tue, 18 Oct 2022 00:18:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=JxG6BQ2cSx0BUaDnxqn3yfQd1HPBIY7Ke6/uNdw3Ahc=; b=phmCuF1Ig88kcRJxP2uSOGxFpsF+Y5JShPbmR4dShI7AYNjVU+lu43U6LtjMOoRaov xEq8uk71FANbwAyo68Azj9rnR3vgiGAfzjkyRpqd6c+SRtZvwCUnc2oEHcr2imAXH7XE AVPjowZCLUxIpxyDzYXMc4FsSxQgt7TDMf90nYM5JNgOUcvSbZeiHWt9uRSkvHOdSMxT iCJQwPD9uZvsD1lxLmcCc1w0+Xc4Fi/BFsA6SSbclugAgt6lsQmSKTXTGQSz+tDO/5Ch 9vXPiNd4k/TvY/VFqIBVwluQxFrHmC6FtabkjQfInt0IL4MqqcT/h4PHB1PHnWnI+5DG AbtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JxG6BQ2cSx0BUaDnxqn3yfQd1HPBIY7Ke6/uNdw3Ahc=; b=Q1bmN9A24GInbuIgKlhbGutXxkelubHwM0l/pIrxK43Z++jeCfkKp0pY4IU7Wdqovm LJRUk3QJ1Np9XxLFX9pLU/2TeuyvMtWDnIsdtht33pvMEVy1glUQkc5HeU1WtAd5wQjc nJLzVHI4Xpai7fxk/QEgqEDLiguwFkblSaz5hk2txASM7LK5RL9FLQNcXacgafQqCKk1 pJu+Z5TqDjNm1OCJEVzcLJV/yyXk0z9DjeRqTlbPWOH2aaC81H8MLnT32dKOf4+X+6+I YAz5pb2ZjJmWpAWP9X8Nit1SntxtDbq8NoqqskYKC2A+bPTTBImNjRcZfGNgEeaFVJTu OiPQ== X-Gm-Message-State: ACrzQf214n/KoP866CdP7RGXzH8cFzfeX8TRmZ0VlTMI9cPYuBbFMqF0 gEAZfsaFLn+vi7eY/prZwl5nRvk22Tpv87paNojl8lDiYwY= X-Google-Smtp-Source: AMsMyM50ZaTlVx+0k716aHS6SFnnOmejkFRsOd0UyL6xog5PlTsAJtL+iofP470t6w4HbfzWwHPZpvxKpk8ichTM9OE= X-Received: by 2002:a02:ca11:0:b0:363:7710:6248 with SMTP id i17-20020a02ca11000000b0036377106248mr1227712jak.320.1666077482673; Tue, 18 Oct 2022 00:18:02 -0700 (PDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?B?5ZCz5oGp57ev?= Date: Tue, 18 Oct 2022 15:17:49 +0800 Message-ID: Subject: Re: ifconfig(8) IEEE802.11 SSID format To: freebsd-hackers@freebsd.org Content-Type: multipart/alternative; boundary="00000000000085ee1c05eb49e467" X-Rspamd-Queue-Id: 4Ms4vb5LKQz3knf X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=phmCuF1I; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of rickywu0421@gmail.com designates 2607:f8b0:4864:20::d2f as permitted sender) smtp.mailfrom=rickywu0421@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::d2f:from]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; MID_RHS_MATCH_FROMTLD(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_FROM(0.00)[gmail.com]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-ThisMailContainsUnwantedMimeParts: N --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 =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
Sorry for not explaining the whole situation.

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.

=E5=90=B3=E6=81=A9=E7=B7=AF <rickywu0421@gmail.com> =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
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

Here is the possible way to solve the problem:<= /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.
--00000000000085ee1c05eb49e467--