Program logic bugs vs input/environmental errors

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 5 13:56:07 PDT 2014


Am Sun, 5 Oct 2014 19:04:23 +0300
schrieb ketmar via Digitalmars-d <digitalmars-d at puremagic.com>:

> On Sun, 5 Oct 2014 17:44:31 +0200
> Marco Leise via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
> 
> > From that I conclude, that File() should open files by ubyte[]
> > exclusively to be POSIX compliant.
> and yet there is currently no way in hell to open file with non-utf8
> name with hardcoded name and without ugly hacks with File("..."). and
> ubyte will not help here, as D has no way to represent non-utf8 string
> literal without unmaintainable shit like "\xNN".
> 
> and speaking about utf-8: for strings we at least have a hack, and for
> shebangs... nothing. nada. ничего. locale settings? other encodings? who
> needs that, there CAN'T be non-utf8 shebangs. OS interoperability? it's
> overhyped, there is only two kinds of OSes: those which are D-compatible
> and bad. changing your locale to non-utf8 magically turns your OS to
> bad, D will not try to interoperate with it anymore.

There comes the day that you have to let Sputnik go and board
the ISS.
Still I and a others agree with you that Phobos should not
assume Unicode locales everywhere, no need to rant.

What I find difficult is to define just where in std.stdio the
locale transcoding has to happen. Java probably just wraps
a stream in a stream in a stream as usual, but in std.stdio it
is just a File struct that more or less directly writes to the
file descriptor. So my guess is, the transcoding has to happen
at an earlier stage. Next, when output is NOT a terminal you
typically want to output with no transcoding or set it up
depending on your needs.
Personally I want transcoding to the system locale when
stdout/stderr is a terminal and UTF-8 for everything else
(i.e. pipes and files). That would be my defaults.

-- 
Marco
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141005/eb59162b/attachment.sig>


More information about the Digitalmars-d mailing list