Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > UTF8 to ASCII?

Reply
Thread Tools

UTF8 to ASCII?

 
 
dtfcalibrator@gmail.com
Guest
Posts: n/a
 
      01-05-2006
This might be addressed somewhere, but I can't keep things straight,
there are so many conversions. I'll just make a new post. Sorry if
this makes anyone annoyed.

I have a webpage I'm reading names from.

For example:
Jos%C3%A9
This is the HTML source. It displays this on the webpage:
Josť

The string I've retrieved in perl is in this format:
"Jos%C3%A9"

I simply want to take this string and be able to print it to a text
file using the following:
open(OUTFILE, ">out.txt");
print OUTFILE "$name";
close OUTFILE;

and find out.txt looks like this:
Josť

Simple, right? Not. Someone help.

 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      01-06-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> The string I've retrieved in perl is in this format:
> "Jos%C3%A9"
>
> I simply want to take this string and be able to print it to a text
> file using the following:
> open(OUTFILE, ">out.txt");
> print OUTFILE "$name";
> close OUTFILE;
>
> and find out.txt looks like this:
> Josť


use URI::Escape;
use Encode;
my $name = 'Jos%C3%A9';
print decode('utf8', uri_unescape $name);

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
given char* utf8, how to read unicode line by line, and output utf8 gry C++ 2 03-13-2012 04:32 AM
UTF8 to Unicode conversion Spamtrap Perl 6 07-31-2004 04:59 AM
open with encoding(utf8) takes forever Erik Sandblom Perl 0 05-28-2004 02:01 PM
LWP::Simple and utf8 problem Thomas =?ISO-8859-15?Q?G=F6tz?= Perl 0 04-19-2004 09:48 AM
Cmenu, Text Interfaces, and UTF8 shade Perl 1 08-11-2003 11:24 AM



Advertisments