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. |
|
|---|