Solved

Embedding non-ascii characters

Posted on 2006-11-06
3
155 Views
Last Modified: 2010-03-05
Hi,
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?
Thanks
Jamie
0
Comment
Question by:jamie_lynn
3 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 17886087
see
perldoc utf8
and
perldoc unicode
0
 
LVL 9

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?
0
 

Author Comment

by:jamie_lynn
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";

Thanks
Jamie
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

759 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now