in reply to Re^2: Win32::API and CreateProcessWithLogonW
in thread Win32::API and CreateProcessWithLogonW

I have a couple of similar routines I use for myself, but I'm reluctant to recommend to others, because of the ire they are likely to draw:

sub A2W{ pack 'S*', unpack 'C*', $_[0] } sub W2A{ pack 'C*', unpack 'S*', $_[0] }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^4: Win32::API and CreateProcessWithLogonW (pack)
by tye (Sage) on Jan 30, 2007 at 07:21 UTC

    I only see two problems. 1) They don't handle the few characters that are in Windows-1252 but not Latin-1. 2) They don't handle the trailing "\0\0" that is needed on the end of wide strings. (1) certainly hasn't bothered me enough to jump through other hoops very often. (2) can be a real problem in some situations and no problem at all in others.

    Oh, and problem (1) that I also mentioned regarding my versions isn't actually a problem for the UTF-18LE / UTF-8 versions; it is just a problem with "ASCII" versions (which really convert to/from Latin-1), now that I think of it.

    - tye