Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Encoding Decoding on multiple formats RFC

by AppleFritter (Vicar)
on Sep 21, 2017 at 08:18 UTC ( #1199808=note: print w/replies, xml ) Need Help??


in reply to Encoding Decoding on multiple formats RFC

This sounds like a rather useful module. Thanks for sharing! (Perlmonks is interpreting square brackets in your code as links, however. Are you sure you're using proper code tags?)

The actual module, that I still have not found a good name to apply. Any ideas for naming please feel free to propose.

Random idea: how about Unicode::Peek, given that you're essentially peeking at how a Unicode string is looking under the hood?

  • Comment on Re: Encoding Decoding on multiple formats RFC

Replies are listed 'Best First'.
Re^2: Encoding Decoding on multiple formats RFC
by hippo (Abbot) on Sep 21, 2017 at 08:28 UTC
    (Perlmonks is interpreting square brackets in your code as links, however. Are you sure you're using proper code tags?)

    thanos1983 is using <pre> tags instead because the <code> tags don't play happily with non-Latin-1 encodings (it's a known problem of long standing). The workaround is to replace the relevant characters (the square brackets) in the source with HTML entities before posting, but that's a faff.

Re^2: Encoding Decoding on multiple formats RFC
by thanos1983 (Priest) on Sep 21, 2017 at 08:39 UTC

    Hello AppleFritter,

    Thank you for time and effort reading and replying to my request for comments. Hmmmm Unicode::Peek not a bad idea, it is exactly as you describe. The module meant to take a quick peek on the encoding. Well since I am also converting into hex why not Unicode::HexPeek?

    Regarding the code tags, as fellow Monk hippo said I am using the <pre></pre> tags to encode the UTF-8 data.

    Again thanks for the interesting ideas, I appreciate it. BR / Thanos

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

      G'day Thanos,

      "... using the <pre></pre> tags to encode the UTF-8 data."

      That's quite correct to do that!

      You also need to replace special characters with entities:

      ForReplaceWith
      HTML&&amp;
      <&lt;
      >&gt;
      PerlMonks[&#91;
      ]&#93;

      [The "HTML" ones are generic (i.e. not just for this site); The "PerlMonks" ones are specific to this site to prevent automatic link generation.]

      These appear under the textarea when you're composing your message:

      "You may need to use entities for some characters, as follows. ..."

      Unfortunately, that list is no longer there when previewing, nor when editing after node creation.

      — Ken

        Hello kcott

        Thanks for the tip, it worked perfectly.

        Best Regards, Thanos

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

      Well since I am also converting into hex why not Unicode::HexPeek?

      That also works. Personally I'd not get too specific however; perhaps you'll find yourself wanting to expand the module beyond hexadecimal "peeking" further down the road. Best not to paint oneself into a corner too early!

        Hello AppleFritter,

        You are absolutely right. Why to produce a dead lock to your self when you are just creating the module. Unicode::Peek it is. :D

        Thanks again for the time and effort.

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2017-10-19 04:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (251 votes). Check out past polls.

    Notices?