Reading ASCII file with some codes above 127 (exten ascii)
Paul
phshaffer at gmail.com
Wed May 23 13:44:23 PDT 2012
> The safest way is probably to read it as binary data (i.e.
> byte[]), then
> do the conversion into UTF8, then process it, and finally
> convert it
> back to latin-1 (in binary form) and output it.
>
> D assumes Unicode internally; if you try to read a Latin-1 file
> as
> char[], you may be running into some implicit UTF conversions
> that are
> corrupting the data. Best use byte[] for reading/writing, and do
> conversions to/from UTF-8 internally for processing.
>
>
> T
You mean something like Era has done in the first reply?
If that is so I have to say I'm really surprized. To write D so
it natively expects and outputs unicode is one thing but not
making a clean simple way to read extended ASCII chars (i.e.
Latin1) and write them back out seems like an oversight.
I think I'm (actually Graham) is close.
Thanks for your feedback HS.
More information about the Digitalmars-d-learn
mailing list