in reply to quotes substitution
#!/usr/bin/perl use warnings; use strict; use HTML::Entities; my $line = qq{” 3”}; my $decode_1 = decode_entities $line; my $decode_2 = decode_entities $decode_1; print qq{$line\n}; print qq{$decode_1\n}; print qq{$decode_2\n}; $decode_2 =~ s/\x{201D}/'/g; #' print qq{$decode_2\n};
The symbols here are the double quotes and the warnings are as expected.Wide character in print at C:\perm\dev\_new.pl line 12. Wide character in print at C:\perm\dev\_new.pl line 13. ” 3” ” 3” ” 3” ' 3'
I have a general rule of thumb: decode often (it doesn't hurt), encode ONCE (or your life will be a misery and you'll have strings of junk like the one you had). :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: quotes substitution
by afoken (Chancellor) on Jun 30, 2009 at 05:51 UTC |