Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Where are your Spanish characters actually coming from? A data file? A web page? User input? How much do you know about your input data? (E.g. would you be able to say or find out what character encoding is being used when the data first comes into your script?)

If you're getting "line drawing characters" at the printer, your script might be sending the characters as utf8, and in that case, using the Encode module (and its "encode()" function), as shown in the first reply, is likely to be the right way to go -- though actually, assuming that perl is initially storing your strings internally as utf8, something like this would be simpler:

binmode( PRN, ":encoding(cp437)" );
By setting a PerlIO layer on your PRN file handle to apply the character encoding transfor for you (from utf8 to cp437), you don't need to do anything else -- you don't need "use Encode", you don't need any substitutions or other alterations of your string data.

Your statement of the problem was vague enough that I can't be sure this is the right answer, but this is a place to start, at least.


In reply to Re: trouble printing spanish characters by graff
in thread trouble printing spanish characters by schweini

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2022-08-16 13:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?