Thread overview
toStringz for UTF-16
Oct 13, 2012
Jonathan M Davis
Oct 13, 2012
Jacob Carlborg
Oct 13, 2012
Andrej Mitrovic
Oct 14, 2012
Jacob Carlborg
Oct 13, 2012
Jonathan M Davis
October 12, 2012
Why doesn't D have toStringz function for UTF-16 encoding?
October 13, 2012
On Saturday, October 13, 2012 01:58:15 Katayama Hirofumi MZ wrote:
> Why doesn't D have toStringz function for UTF-16 encoding?

It does. std.utf.toUTFz will do every combination of char type and constness. And std.utf.toUTF16z will convert any string to a null-terminated const(wchar)*.

- Jonathan M Davis
October 13, 2012
On Saturday, October 13, 2012 01:58:15 Katayama Hirofumi MZ wrote:
> Why doesn't D have toStringz function for UTF-16 encoding?

std.utf.toUTFz will do every combination of char type and constness. And std.utf.toUTF16z will convert any string to a null-terminated const(wchar)*.

- Jonathan M Davis
October 13, 2012
Thanks.


---- END OF THREAD ----
October 13, 2012
On 2012-10-13 02:04, Jonathan M Davis wrote:

> It does. std.utf.toUTFz will do every combination of char type and constness.
> And std.utf.toUTF16z will convert any string to a null-terminated
> const(wchar)*.

Shouldn't we deprecate "toUTF16z" if "toUTFz" can handle all cases that "toUTF16z" does?

-- 
/Jacob Carlborg
October 13, 2012
On 10/13/12, Jacob Carlborg <doob@me.com> wrote:
> On 2012-10-13 02:04, Jonathan M Davis wrote:
> Shouldn't we deprecate "toUTF16z" if "toUTFz" can handle all cases that
> "toUTF16z" does?

This was already proposed before, but it would break too much code.
Anyway there's nothing wrong in having an alias that makes typing
simpler, e.g. toUTF16z vs toUTF!(const(wchar)*).

Phobos has many helper auto functions which make instantiating templates simpler, toUTF16z has that same kind of role.
October 14, 2012
On 2012-10-13 15:45, Andrej Mitrovic wrote:

> This was already proposed before, but it would break too much code.
> Anyway there's nothing wrong in having an alias that makes typing
> simpler, e.g. toUTF16z vs toUTF!(const(wchar)*).
>
> Phobos has many helper auto functions which make instantiating
> templates simpler, toUTF16z has that same kind of role.

Fair enough.

-- 
/Jacob Carlborg