Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

by thanos1983 (Priest)
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 test.pl:

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);

__END__

$ perl test.pl 
هذا اختبار

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

    hex2ascciiDecode

    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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1199910]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2017-12-18 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (500 votes). Check out past polls.

    Notices?