Embedding non-ascii characters

Posted on 2006-11-06
Last Modified: 2010-03-05
I have an ascii encoded file with line
"My name is Jamie"
How can I write my perl script to replace the sentence in Chinese (I have the Chinese translation) and save the file as UTF-8 encoded?
Question by:jamie_lynn
LVL 84

Accepted Solution

ozo earned 500 total points
ID: 17886087
perldoc utf8
perldoc unicode

Expert Comment

by:Suhas .
ID: 17891124
where and how your chinese translation stored?

You want the perl script, which gives the meaning of sentence by extracting the meaning of each word from your database?

Author Comment

ID: 17891322
I want to store the chinese characters in the perl script in a variable.  Then when i see certain English words, i want to replace them with Chinese characters and write out a file as UTF-8 encoded.

I tried this below but it seems like it is not writing a UTF-8 encoded file.

use utf8;
my $msgb = ''some chinese character";

open OUT, ">:utf8",     "output.txt"
print OUT "$msgb\n";


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PERL get the value for query 4 155
Question about @INC variable in perl 1 65
get the last nth lines from a an array if nth element is xxx 2 74
parse a file and get data out 11 80
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question