Create a chinese directory (folder) by Perl in Windows 2000 English OS

Discussion in 'Perl Misc' started by gaolixin, Sep 21, 2004.

  1. gaolixin

    gaolixin Guest

    I am a perl newbie, and I am trying to use a perl program to create a
    folder in Window2000. My WINDOWS 2000 is English OS, but setup using
    Chinese (PRC) as default locale. I am able to create chinese folders
    manually, and able to view them.

    The perl program has a statment like

    use strict; $|++;
    my $VERSION = "1.0";
    use File::Spec::Functions;
    ....
    mkdir $dirpath;

    where $dirpath has chinese chars inside using GB2312 encoding. It
    created a folder but the chinese not readiable .

    Can anybody help me through, can you give me a sample program? Thanks
    a lot!!!

    Thanks, Lixin
    gaolixin, Sep 21, 2004
    #1
    1. Advertising

  2. gaolixin wrote:
    > I am a perl newbie, and I am trying to use a perl program to create a
    > folder in Window2000. My WINDOWS 2000 is English OS, but setup using
    > Chinese (PRC) as default locale. I am able to create chinese folders
    > manually, and able to view them.
    >
    > The perl program has a statment like
    >
    > use strict; $|++;
    > my $VERSION = "1.0";
    > use File::Spec::Functions;
    > ...
    > mkdir $dirpath;
    >
    > where $dirpath has chinese chars inside using GB2312 encoding. It
    > created a folder but the chinese not readiable .


    You may want to try using UTF-16 instead of GB2312 because internally Win2k
    is based on Unicode.

    jue
    Jürgen Exner, Sep 22, 2004
    #2
    1. Advertising

  3. gaolixin

    Ben Morrow Guest

    Quoth (gaolixin):
    > I am a perl newbie, and I am trying to use a perl program to create a
    > folder in Window2000. My WINDOWS 2000 is English OS, but setup using
    > Chinese (PRC) as default locale. I am able to create chinese folders
    > manually, and able to view them.
    >
    > The perl program has a statment like
    >
    > use strict; $|++;
    > my $VERSION = "1.0";
    > use File::Spec::Functions;
    > ...
    > mkdir $dirpath;
    >
    > where $dirpath has chinese chars inside using GB2312 encoding. It
    > created a folder but the chinese not readiable .
    >
    > Can anybody help me through, can you give me a sample program? Thanks
    > a lot!!!


    Use the Encode module to convert the path into UTF16, which is what M$ use
    for international stuff. (completely untested)

    Ben

    --
    "If a book is worth reading when you are six, *
    it is worth reading when you are sixty." - C.S.Lewis
    Ben Morrow, Sep 22, 2004
    #3
  4. gaolixin

    Mihai N. Guest

    >> I am a perl newbie, and I am trying to use a perl program to create a
    >> folder in Window2000. My WINDOWS 2000 is English OS, but setup using
    >> Chinese (PRC) as default locale. I am able to create chinese folders
    >> manually, and able to view them.

    If you have the default system locale set to Chinese, it should work.
    From "Control Panel" open "Regional Options", "General" tab, then
    "Set Default" (button, left-bottom), select "Chinese (PRC)", "Ok", reboot.
    User locale is not enough.

    > Use the Encode module to convert the path into UTF16, which is what M$ use
    > for international stuff. (completely untested)

    Unlikely. Perl.exe is not a Unicode application.

    --
    Mihai
    -------------------------
    Replace _year_ with _ to get the real email
    Mihai N., Sep 24, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jack
    Replies:
    2
    Views:
    445
  2. =?Utf-8?B?UmFlZCBTYXdhbGhh?=

    English/English DLL

    =?Utf-8?B?UmFlZCBTYXdhbGhh?=, Oct 15, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    1,659
    =?Utf-8?B?UmFlZCBTYXdhbGhh?=
    Oct 16, 2005
  3. IchBin
    Replies:
    1
    Views:
    758
  4. larry
    Replies:
    0
    Views:
    286
    larry
    Dec 22, 2006
  5. Replies:
    1
    Views:
    348
    Nick Chan
    Sep 17, 2007
Loading...

Share This Page