digitalmars.D - toStringz for UTF-16
- "Katayama Hirofumi MZ" <katayama.hirofumi.mz gmail.com> Oct 12 2012
- "Jonathan M Davis" <jmdavisProg gmx.com> Oct 12 2012
- Jacob Carlborg <doob me.com> Oct 13 2012
- Jacob Carlborg <doob me.com> Oct 14 2012
- "Jonathan M Davis" <jmdavisProg gmx.com> Oct 12 2012
- "Katayama Hirofumi MZ" <katayama.hirofumi.mz gmail.com> Oct 12 2012
- Andrej Mitrovic <andrej.mitrovich gmail.com> Oct 13 2012
Why doesn't D have toStringz function for UTF-16 encoding?
Oct 12 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
Oct 12 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
Oct 13 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
Oct 14 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
Oct 12 2012
Thanks. ---- END OF THREAD ----
Oct 12 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.
Oct 13 2012









Jacob Carlborg <doob me.com> 