Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^7: Writing UTF8 Filename (Win32)

by Juerd (Abbot)
on Nov 18, 2007 at 01:13 UTC ( #651472=note: print w/ replies, xml ) Need Help??


in reply to Re^6: Writing UTF8 Filename (Win32)
in thread Writing UTF8 Filename

Wow. That would suck, IMHO. Talk about a complicated mess of an over-designed system.

I don't think it would suck or is over designed. In the common case, you would use file functions like you do now, and Perl handles everything transparently. ${^FS_ENCODING} would default to auto, resulting in autodetection for the entire system. When you want to port your latin1 mp3 collection to utf8 (to name one real world case), it would be exceptionally easy to do so: given proper OS support it would detect the encodings automatically, and without the OS support you can still override them with two lines of code.

The problem with ANY win32-only code, or any-platform-only code, is that you put the burden of writing portable applications on the programmer. Hence, some abstraction would be nice. If only perl provided useful hooks for encoding filenames in general, that would be a great start, and also provide nice ways of dealing with existing systems. Program written to support only absolute filenames? Hack hack, and it does what you want.

Juerd # { site => 'juerd.nl', do_not_use => 'spamtrap', perl6_server => 'feather' }


Comment on Re^7: Writing UTF8 Filename (Win32)
Re^8: Writing UTF8 Filename (Win32)
by tye (Cardinal) on Nov 18, 2007 at 04:34 UTC

    Please put your complex plan into a module and not into Perl itself.

    The problem with ANY win32-only code, or any-platform-only code, is that you put the burden of writing portable applications on the programmer. Hence, some abstraction would be nice.

    The abstraction is that file names/paths that are Unicode (UTF-8) strings in Perl should be supported. That'll also be the abstraction that gets supported at the low level when Unix catches up to Win32, surely. That's the only abstraction that makes much sense. Sure, in the short term, there will be awkward steps to try to bridge between 8-bit chars and Unicode, but those are going to be awkard and non-portable and best kept out of the way of those who don't get stuck having to use them.

    - tye        

      Please put your complex plan into a module and not into Perl itself.

      But of course! If it can be done in a module, it usually should.

      If all filename using things can be overridden, taking over global functions could suffice.

      Juerd # { site => 'juerd.nl', do_not_use => 'spamtrap', perl6_server => 'feather' }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-10-02 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (49 votes), past polls