GithubHelp home page GithubHelp logo

Comments (6)

sdushantha avatar sdushantha commented on May 14, 2024

I am unsure of why this is happening. Maybe this is happening because your system's language is Latin a language. I don't use Windows so I unfortunately can't debug this error.

from wifi-password.

sunrabbit123 avatar sunrabbit123 commented on May 14, 2024

My ststem language is korean

But this doesn't matter in code.

We need more examples.

from wifi-password.

littlediobolic avatar littlediobolic commented on May 14, 2024

This is likely affecting all windows boxes, at least it does on mine aswell. It likely has to do with the symbols the qrcode library is sending. I dont believe the windows terminal is UTF-8, therefore UTF-8 specific symbols dont display properly like they do on Mac and Linux. However in testing this I also noticed that outputting to image might also be broken? At least it is for me.

@sdushantha I think this might be an issue of the qrcode.print_tty() function. The next best thing in Windows might be their print_ascii function but I havent tested it

Confirmation of it being broken on mine:
wifi-password

Error when attempting to output to image file:
image-error

from wifi-password.

sdushantha avatar sdushantha commented on May 14, 2024

@sunrabbit123 @littlediobolic I think I found a solution to this issue.

In the beginning of the main function, could you add this code:

import colorama
colorama.init()

This will emulate support for ANSI escape sequences, which is needed in order to display the QR code.

If you don't have colorama installed, you'll have to install it through pip:

python3 -m pip install --user colorama

from wifi-password.

sunrabbit123 avatar sunrabbit123 commented on May 14, 2024

Your solution works very sexy.

However, it would be better to write the phrase in generate_qr_code rather than main.

ex:

def generate_qr_code(ssid, password, image=False):
    # Source: https://git.io/JtLIv
    text = f"WIFI:T:WPA;S:{ssid};P:{password};;"

    qr = qrcode.QRCode(version=2,
                       error_correction=qrcode.constants.ERROR_CORRECT_L,
                       box_size=10,
                       border=4)
    qr.add_data(text)

    if image:
        file_name = ssid.replace(" ", "_") + ".png"
        img = qr.make_image()
        img.save(file_name)
        print(f"QR code has been saved to {file_name}")
        os.system(file_name)
    else:
        import colorama
        colorama.init()
        qr.make()
        qr.print_tty()

from wifi-password.

sdushantha avatar sdushantha commented on May 14, 2024

This issue has been fixed in a4cbf0d

from wifi-password.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.