Coder Social home page Coder Social logo

Comments (8)

Pyroseza avatar Pyroseza commented on May 18, 2024 1

Hi @sepandhaghighi, I am using gitbash (mingw64)

from art.

Pyroseza avatar Pyroseza commented on May 18, 2024 1

Interesting... thanks for the feedback, looking forward to the future release

from art.

sepandhaghighi avatar sepandhaghighi commented on May 18, 2024

@Pyroseza Hi
Would you please give us more information about your environment(CMD,PowerShell and ...)?

from art.

sepandhaghighi avatar sepandhaghighi commented on May 18, 2024

It seems git bash does not support all 1-Line arts.
We will filter Non-ASCII arts for rand mode in a future release

from art.

Pyroseza avatar Pyroseza commented on May 18, 2024

Hi there, I’ve just done some reading up and found that mingw does not start up in UTF-8 but it can be both configured in the settings and it can be configured in memory for the current session using an environment variable LANG='C.UTF-8'

My suggestion is to set this variable if it is not set, then output the characters, I don’t know if this will work for sure but more can be seen here: https://stackoverflow.com/a/36692549

I’ll be testing this shortly and confirm if it works or not, if not I will do a little more research on my side.

from art.

Pyroseza avatar Pyroseza commented on May 18, 2024

So bad news that did not work for me, looks like mingw64 (a.k.a. git bash) does not play nice when outputting unicode chars. I did confirm that it works great in powershell.

from art.

Pyroseza avatar Pyroseza commented on May 18, 2024

I found a solution but not the preferred solutio, it seems to be the way that python is launched without a UTF-8 encoding for IO, it launches windows' 'cp-1252'.

I found that if I set this particular environment variable PYTHONIOENCODING=utf-8 before running my script it works perfectly, if I try set it inside the script it does not work at all.

Here is my proof it works:

$ PYTHONIOENCODING=utf-8 py.exe -3 aprint.py
\(◑д◐)>∠(◑д◐)
$ PYTHONIOENCODING=utf-8 py.exe -3 aprint.py
(ᾢȍˬȍ)ᾢ ļ ļ ļ ļ ļ

This is where I found the solution:
https://stackoverflow.com/questions/4374455/how-to-set-sys-stdout-encoding-in-python-3

I still think there must be a way to set this programmatically from your lib... I'm sure of it, or at least something similar...

from art.

sepandhaghighi avatar sepandhaghighi commented on May 18, 2024

@Pyroseza
Thanks for your effort.
Changing PYTHONIOENCODING environment variable is not a stable solution, because it may effect other programs and also is not applicable in all environments.
I think the best solution is filtering Non-ASCII 1-line arts for rand mode.

from art.

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.