| Thread overview | |||||||||
|---|---|---|---|---|---|---|---|---|---|
|
October 12, 2012 toStringz for UTF-16 | ||||
|---|---|---|---|---|
| ||||
Why doesn't D have toStringz function for UTF-16 encoding? | ||||
October 13, 2012 Re: toStringz for UTF-16 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Katayama Hirofumi MZ | 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 Re: toStringz for UTF-16 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Katayama Hirofumi MZ | 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 Re: toStringz for UTF-16 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | Thanks. ---- END OF THREAD ---- | |||
October 13, 2012 Re: toStringz for UTF-16 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | 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 Re: toStringz for UTF-16 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | 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 Re: toStringz for UTF-16 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | 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 | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply