I would have to write similar wrappers for all other functions that take a filename argument (mkdir(), chdir(), open(), opendir(), rename(), unlink(), glob() and friends...). This can't be it!? :)
I'm probably not the right person to answer this (so I hope someone else comes up with a better answer...), but this sort of question has come up before (with a reprise), and 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.
Your case takes the issue to a deeper level than the other monk, who just needed to handle windows/greek file names from a cgi script. In order to get a wide assortment of existing scripts to work with Perl 5.8.x, the kind of module you've started with is probably the way I would go -- just expand it to cover the other built-ins as needed.
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?)
Presumably, you'll also need to deal with making sure that all file handles are set to ":encoding(cp932)" as well; that would just be included in the replacement function for "open", as well as adding "binmode STDIN,...; binmode STDOUT,...; binmode STDERR,...;" as an executable part of your new version of I18N/Japanese.pm. If/when your people start handling utf8 content in data files, this might get tricky; good luck with that...
In reply to Re: Using literal Japanese filenames in legacy CP932 encoding with system(), etc.
by graff
in thread Using literal Japanese filenames in legacy CP932 encoding with system(), etc.
by almut
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |