access_points icon indicating copy to clipboard operation
access_points copied to clipboard

adjust line indices when encounter CJK characters

Open YJack0000 opened this issue 3 years ago • 4 comments

Through my experiment, I found that the problem is because there is no BSSID provided in airport -s that have CJK SSID. Actually the chinese characters is properly indented to the left. Screen Shot 2022-12-26 at 9 46 58 PM Screen Shot 2022-12-26 at 9 48 20 PM So I add 19 whitespaces in the line to make it like others and it work fine. Screen Shot 2022-12-26 at 9 53 05 PM Screen Shot 2022-12-26 at 9 53 34 PM

YJack0000 avatar Dec 26 '22 13:12 YJack0000

thanks a lot for the attempt!

I think a few issues:

  • what if it is mixed and sometimes there is BSSID, then 19 will not work? Or maybe it never happens (also non CJK)?
  • in the code I think you mean to test re.search(u"[\uac00-\ud7a3]", x) and not (re.search(u"[\uac00-\ud7a3]", texts)
  • I think the regex does not work with unicode range in them, perhaps there is another way to detect CJK?

It would be useful if you test the code to see if it works.

You can install access points from your local branch by using pip install -e . in your access_points folder

kootenpv avatar Dec 28 '22 00:12 kootenpv

ok~I think maybe I can just detect whether it has BSSID at first. Also,should i write a new test file for it? Or I just change the file that test OSXWifiScanner?

YJack0000 avatar Dec 29 '22 06:12 YJack0000

Probably best to add an extra test (specifically for another language) 👌

kootenpv avatar Dec 30 '22 00:12 kootenpv

After trying a few times and using sudo to see the BSSID format, I found that OSX Monterey just changed the BSSID to spaces. My first attempt was therefore wrong. Screen Shot 2023-01-04 at 2 26 38 AM Screen Shot 2023-01-04 at 2 28 34 AM However, I noticed an interesting pattern. In the above image, I found that it is not 19 spaces for the BSSID, but rather (chinese word count * 2 + 1). I thought this might be because the length of a Chinese character in a Python string is 1, but the actual size is 3 bytes. When airport -s prints out the result, it views it as three bytes, but when I use Python to slice strings, the Chinese character has a length of 1."

YJack0000 avatar Jan 03 '23 18:01 YJack0000