in reply to Re: convert 7 bit even parity to 7 bit ascii
in thread convert 7 bit even parity to 7 bit ascii

ok here it is:
a com object returns a binary string to perl in ascii 7 bit (8 bit for popular terms)

perl converts this binary to ascii 7 bit even parity by default when the com objects return value is set to a scalar.
binary data from com object looks something like this:
79a30bf0ac64fc0e469f0568562e43e53f89a3f46f7437d44d96dcd5087b20056df7fcb07485f0c0 (7 bit ascii even parity)

the same com object used in .net or asp returns binary value in ascii 7 bit (8bit for popular term)

i can't have this happen becuase the two systems won't decrypt the same value correctly through the com object.

some Hex values in ascii 7 bit even parity represent chars differently compared to the Hex representation of the same character in 7 bit ascii

I need to find a way for perl not to transfer the binary string returned from the com object into 7 bit even parity. this changes the hex values thus cannot be converted correctly by the .net apps that read in the perl stored values.
  • Comment on Re: Re: convert 7 bit even parity to 7 bit ascii

Replies are listed 'Best First'.
Re: Re: Re: convert 7 bit even parity to 7 bit ascii
by theorbtwo (Prior) on Mar 10, 2004 at 03:34 UTC

    The easy was to convert from data+parity to data is to & your input with 0x7F. Note that this destroys any benifit the parity might have (in this case, none).

    If you've got a bunch of data in $data, and want to strip the high bit, try $data = chr(0x7F) x length($data);.

    Note that I suspect your actual problem has little to do with parity vs non-parity, but rather with utf-8 encoding. I know of nowhere in perl that cares about parity.


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Re: Re: Re: convert 7 bit even parity to 7 bit ascii
by iburrell (Chaplain) on Mar 10, 2004 at 22:01 UTC
    What is the data from the COM object supposed to look like? Are you certain it is 7-bit ASCII with no bytes with the high bit set? In other words, with no extended characters in it.

    Perl is almost certainly not converting to "7-bit even parity" because it doesn't know about any such thing. The only place I have seen "even parity" used is with modems. Not to mention that the string you presented is not even partity.

    That string is not in UTF-8 but it is still likely an encoding issue. Win32::OLE does have an option to set the code page for translating Unicode strings to Perl strings. You might want to check its value or explicitly set it the code page.

Re: Re: Re: convert 7 bit even parity to 7 bit ascii
by bear0053 (Hermit) on Apr 06, 2004 at 17:03 UTC
    why was this node voted down???