Hi, Thanks for directing me to good source. Anyway, I wrote a simple perl code. here' my code.
#!/usr/bin/perl use CGI ':standard'; use strict; use warnings; use CGI::Carp 'fatalsToBrowser'; # use only for testing use Encode qw(encode decode); no warnings 'utf8'; print "Content-Type: text/html; charset=utf-8\n\n"; my $subject = "Room Rush \303\242\302\200\302\223 Enjoy 25% off on you +r stay. (raw: Room Rush =?utf-8?b?4oCT?= Enjoy 25% off on your stay.) +"; $subject =~ s/[^[:ascii:]]+//g; # get rid of non-ASCII characters my $subject_decoded = decode("MIME-Header", $subject); #my $subject_decoded = decode("MIME-B", $subject); #my $subject_decoded = decode("MIME-Q", $subject); print "\n"; print "<br/>"; print "subject: $subject \n\n"; print "<br/>"; print "subject_decoded: $subject_decoded \n\n";
here's what I get via web browser.
subject: Room Rush Enjoy 25% off on your stay. (raw: Room Rush =?utf-8?b?4oCT?= Enjoy 25% off on your stay.) subject_decoded: Room Rush Enjoy 25% off on your stay. (raw: Room Rush – Enjoy 25% off on your stay.)
But, the word " raw: " still appears?
Is this code good? How to enhance it? Anyway, I spent many hours to write the code since I still learn perl
In reply to Re^2: utf8 in perl
by theravadamonk
in thread utf8 in perl
by theravadamonk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |