Read a file character by character/UTF8: Difference between revisions

(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
Line 370:
 
=={{header|Java}}==
 
<syntaxhighlight lang="java">import java.io.FileReader;
import java.io.FileReader;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
Line 377 ⟶ 379:
 
public static void main(String[] args) throws IOException {
final int endOfFile = -1;
var reader = new FileReader("input.txt", StandardCharsets.UTF_8);
while (true) {
vartry ( FileReader reader = new FileReader("input.txt", StandardCharsets.UTF_8); ) {
int c = reader.read();
while ( true ) {
if (c == -1) break;
int cch = reader.read();
System.out.print(Character.toChars(c));
if ( ch == }endOfFile ) {
break;
}
System.out.printprintln(Character.toChars(cch));
}
}
}
}
}</syntaxhighlight>
 
=={{header|jq}}==
871

edits