Guest User

Untitled

a guest
Mar 24th, 2017
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.62 KB | None | 0 0
  1. use utf8;
  2. use Encode;
  3. use Devel::Peek;
  4.  
  5. # Same string as you had.
  6. utf8::upgrade( my $string = "\x{c3}\x{a9}l\x{c3}\x{a8}ve\n" );
  7. { my $string = $string;  Encode::_utf8_off( $string );  Dump($string); }
  8. { my $string = $string;  utf8::encode( $string );       Dump($string); }
  9.  
  10. __END__
  11. Output:
  12. SV = PV(0x1bc7290) at 0x1be3f98
  13.   REFCNT = 1
  14.   FLAGS = (POK,pPOK)
  15.   PV = 0x1bdd440 "\303\203\302\251l\303\203\302\250ve\n"\0
  16.   CUR = 12
  17.   LEN = 14
  18. SV = PV(0x1bc72b0) at 0x1bf12f0
  19.   REFCNT = 1
  20.   FLAGS = (POK,IsCOW,pPOK)
  21.   PV = 0x1ceb1c0 "\303\203\302\251l\303\203\302\250ve\n"\0
  22.   CUR = 12
  23.   LEN = 17
  24.   COW_REFCNT = 1
Advertisement
Add Comment
Please, Sign In to add comment