What is the universal way to use file I/O API with unicode filenames?

Posted by dma_k on Stack Overflow See other posts from Stack Overflow or by dma_k
Published on 2010-05-09T00:10:53Z Indexed on 2010/05/09 0:18 UTC
Read the original article Hit count: 147

Filed under:
|
|

In Windows there is a common problem: the filenames should be converted to local codepage, before they are passed to open(). Of course, there is a possibility to use Win32::API for that, but I don't want my script to be platform-dependent. At the moment I have to write something like:

open IN, "<", encode("cp1251", $filename) or die $!; 

but is there any library, that hides these details? I think the local codepage can be automatically detected, so I just want to pass unicode filename and forget about the details. Why is it still not in the box?

© Stack Overflow or respective owner

Related posts about perl

Related posts about unicode