www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - utf ranges

reply Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
Is there a way in phobos to reencode a dchar range as a utf8 bytestream?
Nov 30 2010
parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
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
Nov 30 2010
parent Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
 I'm afraid that I'm not clear enough on exactly what you're looking to do to
 give you a proper suggestion.
on further reflection, neither am I. I suppose to!string is what I want
Nov 30 2010