hello monks, I found some nodes on multibyte regexes, but none on printing. I have the following regex, that describes the Shift-JIS encoding (from http://www.perl.org/tpc/1998/User_Applications/Perl%20and%20Multiple-byte%20Char/perl2-lunde-paper.pdf)
$sjis= q{ # Shift-JIS encoding <[0-9A-F][0-9A-F][0-9A-F][0-9A-F]> + # CDPS Unicode tag | &\#x[0-9A-F][0-9A-F][0-9A-F][0-9A-F]; + # SGML Unicode tag | [\x00-\x7F] + # ASCII | [\x81-\x9F\xE0-\xFC][\x40-\x7E\x80-\xFC] + # Two-byte range | [\xA0-\xDF] + # Half-width katakana };
My goal is to create a random string from this (or any other) regex. I got through the parsing part but am now stuck with the correct byte sequences. In e.g. \x83\xE3 and \x44\x81 are 2 correct 2-byte characters (from rule [\x81-\x9F\xE0-\xFC][\x40-\x7E\x80-\xFC]). The problem is: how do I print them - i can print byte by byte, but that does not give the correct results. To sum up: i have the correct byte sequence, i know which bytes "go together", i just don't know how to print the multibyte chars. Appreciate your aid, Deda.

In reply to printing multibyte chars by Deda

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.