Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

It helps if you think about it like this:

There is the inside of your program, and there is the outside world, and there is (or at least, should be) one clean and definite interface between the two. In the inside of your program you use strings that consist of (potentially wide) characters. The outside world deals with a stream of octets. When you read something from the outside world into your program, you convert (decode) from octets to a string of characters, and when you emit something from your program to the outside world, you convert (encode) the characters into a stream of octets.

The precise mechanics of those encode/decode steps depend on the application and the kind of protocol used. There isn't (and cannot be) a single answer whether you should or should not use Encode::encode("UTF-8", ...).

In your HTTP example, the need to encode depends on what the other side requires. Again, we can't tell in general. Presumably, it's documented by the service you're trying to POST to. The encoding you use should match the contents specified in the Content-Type header: if it's text/html; charset=UTF-8, then you must encode as UTF-8, if it's e.g. image/png, you must not.

In reply to Re: Perl strings questions by kikuchiyo
in thread Perl strings questions by bliako

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 How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2023-02-02 20:30 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (22 votes). Check out past polls.