LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-02-2004, 03:00 PM   #1
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,613

Rep: Reputation: 47
I need perlscript to convert text file in UTF-16


hi

I need perlscript to convert text file
in UTF-16 using perl module Unicode::Map

http://search.cpan.org/~mschwartz/U...ap-0.112/Map.pm

greetings
cccc
 
Old 07-02-2004, 03:26 PM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Can't you just use
Code:
recode latin1..utf16 yourfile.txt
?
 
Old 07-03-2004, 07:12 PM   #3
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,613

Original Poster
Rep: Reputation: 47
thanks, but howto use this command from perl script ?
 
Old 07-04-2004, 04:08 AM   #4
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Just as any other external program,
eg.
Code:
#!/usr/bin/perl -w
system("recode latin1..utf16 foo.txt");
To do the equivalent with Unicode::Map library (reads Latin1 from stdin and writes UTF16 to stdout):
Code:
#!/usr/bin/perl -w

use Unicode::Map();
$Map = new Unicode::Map("ISO-8859-1");
print $Map->to_unicode($_) while(<>);
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Enter] in text documents diffrent on Windows and Linux? UTF-8/UTF-16 problem or? brynjarh Linux - General 1 11-24-2004 05:20 AM
convert text file to binary excel file ust Linux - General 2 11-23-2004 02:33 AM
convert CSV (TEXT) files to UTF-16 cccc Programming 1 07-01-2004 01:54 AM
need a perlscript to read from a text file and transfer files via ftp cccc Linux - Networking 2 02-21-2004 06:18 PM
how can I convert a text file to a html one? kevin_liu Linux - Software 2 07-16-2003 06:09 AM


All times are GMT -5. The time now is 05:16 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration