Do you know where your variables are? PerlMonks

### Upside Down Text Revised

by PilotinControl (Monk)
 on Mar 07, 2013 at 22:13 UTC Need Help??
PilotinControl has asked for the wisdom of the Perl Monks concerning the following question:

Hello Again Monks! I have a updated my question and the code is below. Simply put I am trying to use the Upside down Text module and here is my updated code Thanks!

use warnings;
use strict;
use auto;
use Text::UpsideDown;
use Win32::Unicode::Console;
use Win32::Console;

print ("TEST RIGHT SIDE UP\n");
printW upside_down ("TEST UPSIDE DOWN\n");
printW upside_down ("I \x{2665} Perl\n\n");
sleep (10);

Output on Screen:

TEST RIGHT SIDE UP

?MO? ??I??

[download]

How do I rectify this code to show everything and remove the "?" ? I am using Activestate Perl Thanks!

Replies are listed 'Best First'.
Re: Upside Down Text Revised
by mbethke (Hermit) on Mar 07, 2013 at 23:43 UTC
Try running it with perl -CS so it will UTF-8-encode the output even if perl would otherwise use Latin based on your environment. If it still looks crap, it's likely to be your terminal's fault.

Try running it with perl -CS so it will UTF-8-encode the output

That is what printW does, see Win32::Unicode::Console

Sorry, my bad! Well, that makes the terminal the main suspect. Maybe pipe to something akin to xxd on Windows, or perl -ne'printf "%02x ",ord \$_ for split//' to further diagnose?
Re: Upside Down Text Revised
by nikosv (Chaplain) on Mar 08, 2013 at 08:27 UTC
The windows console does not play along with Unicode. you might want to check print UTF-8 problem
Re: Upside Down Text Revised
by Anonymous Monk on Mar 07, 2013 at 22:27 UTC

chcp 65001 produces even worse output

chcp 65001 produces even worse output

What does that mean?

Maybe you need to switch to a unicode font

OTOH, upsidedown text is clownshoes :)

Re: Upside Down Text Revised
by pvaldes (Chaplain) on Mar 10, 2013 at 23:17 UTC

the output it is having trouble finding the upside down equivalent to ...

If you want to have any text (really) rotated upside down or mirrored you probably should consider Latex. It is probably the easier option keeping the text format (avoiding to convert all stuff to an image), thus you can still search for (most of) the text. Please note that this will not print directly to a terminal, instead a pdf with the text placed exactly as you want (in your wildest formating's dreams) will be created.

---- file example.tex
\documentclass[40pt]{article}
\usepackage{rotating}

\begin{document}

Perlmonks
\reflectbox{Perlmonks}\\
\rotatebox{92}{Perlmonks}
\rotatebox{68}{{\bf Perlmonks}}
\reflectbox{\rotatebox{60}{Perlmonks}}

\end{document}
--- end of file example.tex
[download]

To use, (install miktex and..) run in a shell as: pdflatex example.tex

And then simply open example.pdf with your favourite pdf's viewer

See MikTex and also Latex::Driver

Re: Upside Down Text Revised
by Anonymous Monk on Mar 10, 2013 at 21:44 UTC

Well, I don't have a font that cmd.exe can use to display unicode

OTOH, ud hello will produce unicode, and if I save it as file.txt and view it in notepad with a unicode font, I see hello upsidedown (well, if I squint, the upside down L's aren't really upside down L's, but they look real close)

AFAIK, http://conemu.sf.net , http://console.sf.net, powershell can display unicode

Log In?
 Username: Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1022309]
Approved by marto
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2017-10-24 12:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My fridge is mostly full of:

Results (289 votes). Check out past polls.

Notices?