Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: How can I safely unescape a string.

by remiah (Hermit)
on Sep 13, 2012 at 12:55 UTC ( #993480=note: print w/ replies, xml ) Need Help??


in reply to How can I safely unescape a string.

oct('0'. NNN) converts octal string to decimal number.
pack('U', decimal code point) makes utf8 decoded character.

use strict; use warnings; my $str='\334ber@n\374ber.com'; $str =~ s/\\(\d{3})/pack('U', oct('0'.$1))/eg; binmode STDOUT, ":encoding(UTF-8)"; print $str;

I made table of unicode documents for perl. Please have a look at them, they are not so long documents.

perlunitut 6 pages Very very short overview for unicode in perl + FAQ.
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) 8 pages About Charcter Set, Code Page, Unicode itself. Short History of Unicode.
perluniintro 12 pages This is the first thing to read (I think).
Character Encodings in Perl 7 pages all-in-one doc for encoding. Written by German Author.
perlunicode 20 pages Main document of perl's unicode. Through and precise, or too much for beginner.
Perl Programming/Unicode UTF-8 15 pages This document explains internal encoding of Perl (N8CS, utf-8) and also describe other problems. When you stumbled with 0x80-0xFF problem, this document explains the reason.


Comment on Re: How can I safely unescape a string.
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993480]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2014-10-21 02:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (95 votes), past polls