Read a file character by character/UTF8: Difference between revisions
Read a file character by character/UTF8 (view source)
Revision as of 20:23, 29 December 2013
, 10 years ago→version 2: changed EOF handling
Walterpachl (talk | contribs) (added REXX version 2 (show my understanding of this task)) |
Walterpachl (talk | contribs) m (→version 2: changed EOF handling) |
||
Line 101:
* read one utf8 character at a time
* see http://de.wikipedia.org/wiki/UTF-8#Kodierung
*--------------------------------------------------------------------*/
oid='utf8.txt';'erase' oid /* first create file containing utf8 chars*/
Line 111 ⟶ 110:
Call lineout oid
fid='utf8.txt' /* then read it and show the contents */
Do Until c8='EOF'
c8=get_utf8char(fid)
Say left(c8,4) c2x(c8)
End
Exit
get_utf8char: Procedure
Parse Arg f
If chars(f)=0 Then
Return 'EOF'
c=charin(f)
b=c2b(c)
Line 143:
€ E282AC
ð„ž F09D849E
EOF 454F46</pre>
=={{header|Ruby}}==
|