Open Nevon opened 7 years ago
We tested this in docker with Alpine linux. echo
and cowsay
print the unicode characters just fine, so the issue seems to be coming from pokemonsay
.
Great project btw, love it ❤️
Cross-posted this issue upstream, since it looks like the issue is in rossy/img2xterm#9
Thanks for the support guys.
Funny thing, I am Brazilian but I have only tested with English text so far. But it's just like @Nevon said, it looks like an issue with img2xterm.
I've been thinking about this and I think there's a way around the problem. It's not the most elegant solution, but I could remove binmode STDOUT, ":utf8";
from all cowfiles and pipe the output of cowsay
to a sed
process which will remove that warning line.
I went on to experiment with that. I removed the binmode
thing and it worked. I've put the thing back again expecting it to not work... and it also worked. Suddenly I don't understand anything anymore, but mine is working with a clean repo. It's like I have done nothing, but it is working.
I wish I've noticed what happened and I would come up with a solution, but I don't.
sed
sounds like a beautiful solution to me. No need for more if it works. :shipit:
Guys, could you try the branch unicode
. I think there is no need to install, just clone the repo and do ./pokemonsay.sh "こんにちは世界"
a few times. I might have fixed the problem.
If you can, please test the master
branch as well. Nothing changed on master
, but I'm puzzled that I can't reproduce the problem anymore.
I'm sorry it took so long for me to take a look at this. It's my last year in college and things are really tough. xD
At first I figured maybe it was an issue with your expression, so I made one that might be a little more robust, but it's also failing. However, it is matching the text normally, so there's something fishy.
However, it works with a plain non-ansi nonsense cowfile:
Then I thought that maybe the warning was in stderr or something, so I tried combining the streams before doing the sed
, but that didn't work either. Super weird.
Having never written Perl in my life, I have no idea if the following is correct, but I think the binmode(STDOUT, ":utf8");
should stay. The files are encoded as us-ascii, which is a subset of utf8, so we are expecting the output to be utf8. So I went the other direction and modified cowsay
to basically tell it that anything and everything is utf8 and should be treated as such:
use utf8;
binmode STDOUT, ":utf8";
binmode STDERR, ":utf8";
binmode STDIN, ":utf8";
But nope...
I'm sorry it took so long for me to take a look at this. It's my last year in college and things are really tough. xD
Don't kill yourself over it, man. It's a silly way to have pokemon in your terminal, not a cure for cancer.
6 years gone. Did you solve the problem?
6 years gone. Did you solve the problem?
8 years now. :)