On Sunday, 12 March 2023 at 00:54:53 UTC, zjh wrote:
On Saturday, 11 March 2023 at 19:56:09 UTC, 0xEAB wrote:
If you desire to use other encodings, how about using ubyte +
ubyte[]?
There is no example.
To read binary data from a file and dump it into another, you do:
```d
import std.file : read, write;
void[] data = read("infile.txt");
write("outfile.txt", data);
```
To write binary data to a file:
```d
import std.file : write;
ubyte[] data = [0xA0, 0x0A, 0x30, 0x01, 0xFF, 0x00, 0xFE];
write("myfile.txt", data);
```
`data` could contain GBK encoded text, for example. (Just don’t
use `"Unicode literals"`.)