in reply to Re: Why do poisoned null attacks still work ? (sanity)
in thread Why do poisoned null attacks still work ?

I'm curious - wouldn't that prevent you from opening files with UTF-16 encoded names under windows? Or does that use an entirely different API?

If that's not a problem, I'm all for making it fatal.

  • Comment on Re^2: Why do poisoned null attacks still work ? (sanity)

Replies are listed 'Best First'.
Re^3: Why do poisoned null attacks still work ? (UTF-16)
by tye (Sage) on Jul 26, 2009 at 19:33 UTC

    Perl's open can't be used for opening UTF-16-encoded filenames under Windows. To be clear, all filenames are encoded in UTF-16 under the covers in Windows, but the string (of bytes) passed to Perl's open is (eventually) interpretted as a string of 8-bit characters in the current "code page". Passing a UTF-16 string to Perl's open would result in a file with a one-byte name being opened (until this crazy behavior is fixed, at which point it would die).

    In some future version of Perl, it would be nice if open (and lots of other things) could handle out-of-current-code-page characters in filenames (on Win32). That would surely be provided by allowing a Perl-Unicode string to be used as a filename. Internally, perl would notice the "is UTF-8" bit on the string and then translate that string into UTF-16 and then call the alternate underlying API that expects UTF-16 strings. I've actually written code that does this as updates to Win32API::File that I really need to finish merging and testing. /:

    - tye        

Re^3: Why do poisoned null attacks still work ? (sanity)
by ikegami (Patriarch) on Jul 26, 2009 at 19:28 UTC

    open uses the 8-bit ("A") API. It can't open files with names with wide characters. If it could, you'd probably pass it as a Perl string and it would encode it to UCS-2le for you, so there would be no problem.