Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Using literal Japanese filenames in legacy CP932 encoding with system(), etc.

by almut (Canon)
on Oct 25, 2006 at 15:47 UTC ( [id://580610]=note: print w/replies, xml ) Need Help??


in reply to Re: Using literal Japanese filenames in legacy CP932 encoding with system(), etc.
in thread Using literal Japanese filenames in legacy CP932 encoding with system(), etc.

...it seemed to me that the way to go there was to have a module that provides replacements for the built-in functions that take and return file names.

Thanks for your response, and for the pointer to the archived thread. All in all, it makes me feel reassured I'm not entirely on the wrong track (actually, I was hoping I might be ;) and that there in fact is an easier solution). No big issue though, I'll just get on with implementing the wrappers. Any tips from more experienced monks on what subtle pitfalls to avoid along these lines? I figure I should be on the safe side when simply limiting my encoding conversions to scalar arguments (specifically thinking of built-ins with multiple prototypes, like open()...).

Anything "cleaner" would probably take you into hacking the source and building your own patched version of perl, which is probably a less attractive solution overall.

(But wait... Maybe there's a compiler flag that can be set to handle this? I haven't looked at that, but it might be worth looking at even though it sounds like a long-shot... Still, maybe your site isn't eager to be put into the position of having to build their perl installation from sources with customizations?)

Right. I have to admit I haven't really looked into this yet, so I'll do some more RTFM and/or take a peek into the sources. If anyone has any promising hints, I'd of course appreciate it. A simple compile-time switch would be absolutely OK (I'll be building / providing their Perl packages anyway). But I'd rather not do any further patching -- just afraid that too many hacks are going to be a nightmare to maintain in the long run... (which might get them into a similar situation to what they're in now, in another five to ten years).

Presumably, you'll also need to deal with making sure that all file handles are set to ":encoding(cp932)" as well; ...

I already have the stub code in place for these filehandle related things. On the Perl side everything is working beautifully -- thanks to the nice and clean design of Perl IO layers (Kudos to everyone who's been working on this, BTW). What's giving me more of a headache here is that it seems I have to switch between various encodings, depending on what specific version of Windows I'm on, etc. The site is rather heterogeneous, and I guess I don't have to tell you that "no Windows is like any other" -- at least when you get down to the nitty-gritties (e.g. one dumps the registry in ucs-2le, the other in legacy encoding, ...) Moreover, I'm no Windows expert -- just dabbling in largely unknown territory :)

Anyway, thanks again,
Almut

  • Comment on Re^2: Using literal Japanese filenames in legacy CP932 encoding with system(), etc.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://580610]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-19 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found