Read a file character by character/UTF8: Difference between revisions
Read a file character by character/UTF8 (view source)
Revision as of 21:39, 6 January 2019
, 5 years agojq
SqrtNegInf (talk | contribs) m (→{{header|Perl 6}}: fix file open error handling) |
(jq) |
||
Line 325:
codepoint_index="009" character_count="1" unicode_id="U+00032" hex="0x000032" dec="0000050" oct="0000062" string="2" utf-16="0032" utf-8="32" character_name="DIGIT TWO"
</pre>
=={{header|jq}}==
jq being stream-oriented, it makes sense to define `readc` so that it emits a stream of the UTF-8 characters in the input:
<lang jq>def readc:
inputs + "\n" | explode[] | [.] | implode;</lang>
Example:
<lang sh>
echo '过活' | jq -Rn 'include "readc"; readc'
"过"
"活"
"\n"</lang>
=={{header|Julia}}==
|