UTF8 to ASCII?

D

dtfcalibrator

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

Gunnar Hjalmarsson

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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top