Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^2: Encoding Decoding on multiple formats RFC (UPDATED)

by thanos1983 (Vicar)
on Sep 22, 2017 at 12:23 UTC ( #1199910=note: print w/replies, xml ) Need Help??

in reply to Re: Encoding Decoding on multiple formats RFC
in thread Encoding Decoding on multiple formats RFC

Hello Tux,

I had no clue about this module, thanks for pointing out.

Indeed the output of both are very close to each other. The difference that I see is the decode process that the user can take the hex string and convert it back to the original format, where it is also necessary for me. When you do not have the string in original format and you need to see if the encoding occurred correctly.

Again thank you for pointing out this great module as I am impressed by the hex output, I definitely want to add it as a reference so people can use it also.

Update: Well you gave me the idea of that the user should be able to put pieces of DumperOutput and convert them to readable strings. So I added this method:

sub hexDumperInput { my ( $unicodeFormat , $arrayRef ) = @_; my $hexString = join('', split(/ /, join('', @$arrayRef))); return hex2ascciiDecode($unicodeFormat, $hexString); }

Sample of

my $hexArrayRef = [ '06 47 06 30 06 27 00 20 06 27',
		    '06 2e 06 2a 06 28 06 27 06 31' ]

say hexDumperInput('UCS-2', $hexArrayRef);


$ perl 
هذا اختبار

Thanks again for the inspiration and ideas :D. I will added on the module.

BR / Thanos

Seeking for Perl wisdom...on the process of learning...not there...yet!

Replies are listed 'Best First'.
Re^3: Encoding Decoding on multiple formats RFC (UPDATED)
by AppleFritter (Vicar) on Oct 01, 2017 at 10:36 UTC


    BTW, I don't know if anyone ever noticed, but this method name has a typo, it should be hex2asciiDecode. I suggest renaming it, and maybe leaving the misspelled one as a wrapper so as to not break existing code (though at this point in time there's not likely to be a lot).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1199910]
and the monastery is silent...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2018-07-23 06:27 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (459 votes). Check out past polls.