File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -2690,7 +2690,7 @@ $(D Range) that locks the file and allows fast writing to it.
26902690 }
26912691 else static if (c.sizeof == 2 )
26922692 {
2693- import std.utf : toUTF8 ;
2693+ import std.utf : encode, UseReplacementDchar ;
26942694
26952695 if (orientation_ <= 0 )
26962696 {
@@ -2701,9 +2701,9 @@ $(D Range) that locks the file and allows fast writing to it.
27012701 else
27022702 {
27032703 char [4 ] buf;
2704- auto b = toUTF8 (buf, c);
2705- foreach (i ; 0 .. b.length )
2706- trustedFPUTC(b [i], handle_);
2704+ immutable size = encode ! (UseReplacementDchar.yes) (buf, c);
2705+ foreach (i ; 0 .. size )
2706+ trustedFPUTC(buf [i], handle_);
27072707 }
27082708 }
27092709 else
@@ -4462,12 +4462,12 @@ private struct ReadlnAppender
44624462 }
44634463 void putdchar (dchar dc) @trusted
44644464 {
4465- import std.utf : toUTF8 ;
4465+ import std.utf : encode, UseReplacementDchar ;
44664466
44674467 char [4 ] ubuf;
4468- char [] u = toUTF8 (ubuf, dc);
4469- reserve (u.length );
4470- foreach (c; u )
4468+ immutable size = encode ! (UseReplacementDchar.yes) (ubuf, dc);
4469+ reserve (size );
4470+ foreach (c; ubuf )
44714471 buf.ptr[pos++ ] = c;
44724472 }
44734473 void putonly (char [] b) @trusted
Original file line number Diff line number Diff line change @@ -2654,7 +2654,8 @@ void validate(S)(in S str) @safe pure
26542654 }());
26552655}
26562656
2657- /* =================== Conversion to UTF8 ======================= */
2657+ // @@@DEPRECATED_2017-10@@@
2658+ deprecated (" To be removed November 2017. Please use std.utf.encode instead." )
26582659char [] toUTF8 (return out char [4 ] buf, dchar c) nothrow @nogc @safe pure
26592660{
26602661 if (c <= 0x7F )
@@ -2735,9 +2736,8 @@ string toUTF8(S)(S s) if (isInputRange!S && isSomeChar!(ElementEncodingType!S))
27352736 assert (r2.toUTF8.equal([0xF0 , 0x90 , 0x90 , 0xB7 ]));
27362737}
27372738
2738-
2739- /* =================== Conversion to UTF16 ======================= */
2740-
2739+ // @@@DEPRECATED_2017-10@@@
2740+ deprecated (" To be removed November 2017. Please use std.utf.encode instead." )
27412741wchar [] toUTF16 (return ref wchar [2 ] buf, dchar c) nothrow @nogc @safe pure
27422742in
27432743{
You can’t perform that action at this time.
0 commit comments