Deda has asked for the wisdom of the Perl Monks concerning the following question:
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.$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 };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: printing multibyte chars
by Roger (Parson) on Oct 03, 2003 at 14:29 UTC | |
by Deda (Novice) on Oct 06, 2003 at 07:53 UTC |