Tue Aug 07 13:01:13 2012: Request 78820 was acted upon.
Transaction: Correspondence added by SHAY
       Queue: Win32
     Subject: Add Win32::GetACP and Win32::GetOEMCP functions
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: j...@cpan.org
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78820 >


The attached patch (against Win32-0.44) adds interfaces to GetACP() and
GetOEMCP().

However, they actually return information about the operating system
defaults, so GetOEMCP() doesn't get the correct value of a Command
Prompt's code page if you've changed it from its initial default value
using (e.g.) "mode con cp select=...". The patch therefore adds
GetConsoleCP() and GetConsoleOutputCP() as well. The latter is what you
need to correctly get the current console's output code page.

The patch also adds SetConsoleCP() and SetConsoleOutputCP(), since they
can be very useful too. For example, in the core perl t/op/magic.t
script, which started all this for me, it is now possible to set the
console's output code page to match perl's code page (the Windows ANSI
code page) and thus avoid the need to convert the encoding of data read
from the console (which was originally going to be my approach).

Attachment: cp.patch
Description: Binary data

Reply via email to