Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
... I _still_ get: \xc2\xa3

How do you tell?  Did you print it to somewhere, etc.?  What exactly do you finally want to achieve?

In case the idea is to convert the pound sign to Latin-1 encoding, you'd need to encode the decoded string again:

$v = encode('ISO-8859-1', $v);

Here's a complete example (note the differences in the PV representations in the 3 dumps):

#!/usr/bin/perl -w use strict; use Encode; use Devel::Peek; my $v= "%C2%A3"; $v =~ s/%([a-fA-F0-9]{2})/pack('C', hex($1))/eg; Dump $v; my $decoded = decode("UTF-8", $v); Dump $decoded; my $encoded = encode("ISO-8859-1", $decoded); Dump $encoded; __END__ SV = PVMG(0xf98470) at 0xf15d08 REFCNT = 1 FLAGS = (PADMY,SMG,POK,pPOK) IV = 0 NV = 0 PV = 0xf46af0 "\302\243"\0 CUR = 2 LEN = 8 MAGIC = 0xf0f350 MG_VIRTUAL = &PL_vtbl_mglob MG_TYPE = PERL_MAGIC_regex_global(g) MG_LEN = -1 SV = PV(0xeee388) at 0xf16080 REFCNT = 1 FLAGS = (PADMY,POK,pPOK,UTF8) PV = 0xfe40c0 "\302\243"\0 [UTF8 "\x{a3}"] CUR = 2 LEN = 8 SV = PV(0xeee448) at 0xf16110 REFCNT = 1 FLAGS = (PADMY,POK,pPOK) PV = 0xfd44c0 "\243"\0 CUR = 1 LEN = 8

In reply to Re^3: UTF8 URI Escaping by Eliya
in thread UTF8 URI Escaping by snoopy20

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

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (3)
    As of 2015-11-30 10:38 GMT
    Find Nodes?
      Voting Booth?

      What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

      Results (769 votes), past polls