Am I using std.encoding correctly?

2015-11-14 Thread Charles via Digitalmars-d-learn
I have some binary files that I'm reading. At compile time it's unknown what types I'm reading, and if they're strings, how it's encoded. I'm doing something like this: Variant value; switch(type) { ... case Type.STRING: value = cast(dchar[])[];

Re: Am I using std.encoding correctly?

2015-11-14 Thread anonymous via Digitalmars-d-learn
On 14.11.2015 15:55, Charles wrote: I know there's safeDecode, but I'm also fairly confident that all strings can decode safely, already, and if it isn't I'd want an exception thrown from it. Documentation [1] says "The input to this function MUST be validly encoded." It says nothing about an