Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pearl to create files with russian names
03-09-2010, 07:14 PM
Post: #1
pearl to create files with russian names
Hi all,

I'm trying to create files on a Windows XP machine that hold russian language content. The content is generated with perl scripts. The problem is that when I try to give the files meaningful russian names, the filenames come out garbled.

For example:

$u = "работать" ;

$f = magic($u) ; # the magic function is what I am looking for...

open O,">$f" ;

the kind of magic I am trying results in filenames like работать.html
I've tried using encode/decode functions, but I'm obviously not doing it right.


thanks
Find all posts by this user
Quote this message in a reply
03-09-2010, 07:23 PM
Post: #2
RE: pearl to create files with russian names
use Encode like this:
-----------------------------------
use utf8;
use Encode;

$u = "работать";

$f = encode("cp1251", $u);

open O, ">$f" or die "OMG!";

close O;
-----------------------------------

or just save your source .pl file as ANSI text, it will create file without any additional charset conversions.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:

Contact UsDeveloper SolutionReturn to TopReturn to ContentLite (Archive) ModeRSS Syndication