utf ranges

Jonathan M Davis jmdavisProg at gmx.com
Tue Nov 30 19:13:27 PST 2010


On Tuesday 30 November 2010 16:06:39 Ellery Newcomer wrote:
> Is there a way in phobos to reencode a dchar range as a utf8 bytestream?

You could do to!string() to turn it into a UTF-8 array. What precisely are 
looking for with regards to bytestream? You could then write that to a stream 
from std.stream (though std.stream is going to be deprecated), though there is 
no way as far as I know to write a dchar range as UTF-8 code units to a stream 
(if nothing else, because the current std.stream isn't range-based), though I 
suppose that you could convert it a string in smaller chunks (to avoid the extra 
memory allocation) and then write to the stream in chunks.

I'm afraid that I'm not clear enough on exactly what you're looking to do to 
give you a proper suggestion.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list