Lines Matching refs:encode
25 $(LREF encode)
160 assertThrown!UTFException(encode(buf, cast(dchar) 0xD800));
161 assertThrown!UTFException(encode(buf, cast(dchar) 0xDBFF));
162 assertThrown!UTFException(encode(buf, cast(dchar) 0xDC00));
163 assertThrown!UTFException(encode(buf, cast(dchar) 0xDFFF));
164 assertThrown!UTFException(encode(buf, cast(dchar) 0x110000));
2323 size_t encode(UseReplacementDchar useReplacementDchar = No.useReplacementDchar)(
2374 assert(encode(buf, '\u0000') == 1 && buf[0 .. 1] == "\u0000");
2375 assert(encode(buf, '\u007F') == 1 && buf[0 .. 1] == "\u007F");
2376 assert(encode(buf, '\u0080') == 2 && buf[0 .. 2] == "\u0080");
2377 assert(encode(buf, '\uE000') == 3 && buf[0 .. 3] == "\uE000");
2378 assert(encode(buf, 0xFFFE) == 3 && buf[0 .. 3] == "\xEF\xBF\xBE");
2379 assertThrown!UTFException(encode(buf, cast(dchar) 0x110000));
2381 encode!(Yes.useReplacementDchar)(buf, cast(dchar) 0x110000);
2394 assert(encode(buf, '\u0000') == 1 && buf[0 .. 1] == "\u0000");
2395 assert(encode(buf, '\uD7FF') == 1 && buf[0 .. 1] == "\uD7FF");
2396 assert(encode(buf, '\uE000') == 1 && buf[0 .. 1] == "\uE000");
2397 assert(encode(buf, '\U00010000') == 2 && buf[0 .. 2] == "\U00010000");
2398 assert(encode(buf, '\U0010FFFF') == 2 && buf[0 .. 2] == "\U0010FFFF");
2399 assertThrown!UTFException(encode(buf, cast(dchar) 0xD800));
2401 encode!(Yes.useReplacementDchar)(buf, cast(dchar) 0x110000);
2414 assert(encode(buf, '\u0000') == 1 && buf[0] == '\u0000');
2415 assert(encode(buf, '\uD7FF') == 1 && buf[0] == '\uD7FF');
2416 assert(encode(buf, '\uE000') == 1 && buf[0] == '\uE000');
2417 assert(encode(buf, '\U0010FFFF') == 1 && buf[0] == '\U0010FFFF');
2418 assertThrown!UTFException(encode(buf, cast(dchar) 0xD800));
2420 encode!(Yes.useReplacementDchar)(buf, cast(dchar) 0x110000);
2431 assert(encode(buf, '\u0000') == 1 && buf[0 .. 1] == "\u0000");
2432 assert(encode(buf, '\u007F') == 1 && buf[0 .. 1] == "\u007F");
2433 assert(encode(buf, '\u0080') == 2 && buf[0 .. 2] == "\u0080");
2434 assert(encode(buf, '\u07FF') == 2 && buf[0 .. 2] == "\u07FF");
2435 assert(encode(buf, '\u0800') == 3 && buf[0 .. 3] == "\u0800");
2436 assert(encode(buf, '\uD7FF') == 3 && buf[0 .. 3] == "\uD7FF");
2437 assert(encode(buf, '\uE000') == 3 && buf[0 .. 3] == "\uE000");
2438 assert(encode(buf, 0xFFFE) == 3 && buf[0 .. 3] == "\xEF\xBF\xBE");
2439 assert(encode(buf, 0xFFFF) == 3 && buf[0 .. 3] == "\xEF\xBF\xBF");
2440 assert(encode(buf, '\U00010000') == 4 && buf[0 .. 4] == "\U00010000");
2441 assert(encode(buf, '\U0010FFFF') == 4 && buf[0 .. 4] == "\U0010FFFF");
2443 assertThrown!UTFException(encode(buf, cast(dchar) 0xD800));
2444 assertThrown!UTFException(encode(buf, cast(dchar) 0xDBFF));
2445 assertThrown!UTFException(encode(buf, cast(dchar) 0xDC00));
2446 assertThrown!UTFException(encode(buf, cast(dchar) 0xDFFF));
2447 assertThrown!UTFException(encode(buf, cast(dchar) 0x110000));
2449 assert(encode!(Yes.useReplacementDchar)(buf, cast(dchar) 0x110000) == buf.stride);
2457 size_t encode(UseReplacementDchar useReplacementDchar = No.useReplacementDchar)(
2489 assert(encode(buf, '\u0000') == 1 && buf[0 .. 1] == "\u0000");
2490 assert(encode(buf, '\uD7FF') == 1 && buf[0 .. 1] == "\uD7FF");
2491 assert(encode(buf, '\uE000') == 1 && buf[0 .. 1] == "\uE000");
2492 assert(encode(buf, 0xFFFE) == 1 && buf[0] == 0xFFFE);
2493 assert(encode(buf, 0xFFFF) == 1 && buf[0] == 0xFFFF);
2494 assert(encode(buf, '\U00010000') == 2 && buf[0 .. 2] == "\U00010000");
2495 assert(encode(buf, '\U0010FFFF') == 2 && buf[0 .. 2] == "\U0010FFFF");
2497 assertThrown!UTFException(encode(buf, cast(dchar) 0xD800));
2498 assertThrown!UTFException(encode(buf, cast(dchar) 0xDBFF));
2499 assertThrown!UTFException(encode(buf, cast(dchar) 0xDC00));
2500 assertThrown!UTFException(encode(buf, cast(dchar) 0xDFFF));
2501 assertThrown!UTFException(encode(buf, cast(dchar) 0x110000));
2503 assert(encode!(Yes.useReplacementDchar)(buf, cast(dchar) 0x110000) == buf.stride);
2510 size_t encode(UseReplacementDchar useReplacementDchar = No.useReplacementDchar)(
2528 encode(buf, '\u0000'); assert(buf[0] == '\u0000');
2529 encode(buf, '\uD7FF'); assert(buf[0] == '\uD7FF');
2530 encode(buf, '\uE000'); assert(buf[0] == '\uE000');
2531 encode(buf, 0xFFFE ); assert(buf[0] == 0xFFFE);
2532 encode(buf, 0xFFFF ); assert(buf[0] == 0xFFFF);
2533 encode(buf, '\U0010FFFF'); assert(buf[0] == '\U0010FFFF');
2535 assertThrown!UTFException(encode(buf, cast(dchar) 0xD800));
2536 assertThrown!UTFException(encode(buf, cast(dchar) 0xDBFF));
2537 assertThrown!UTFException(encode(buf, cast(dchar) 0xDC00));
2538 assertThrown!UTFException(encode(buf, cast(dchar) 0xDFFF));
2539 assertThrown!UTFException(encode(buf, cast(dchar) 0x110000));
2541 assert(encode!(Yes.useReplacementDchar)(buf, cast(dchar) 0x110000) == buf.stride);
4503 fill = cast(ushort) encode!(useReplacementDchar)(buf, dc);
4559 backFill = cast(ushort) encode!(useReplacementDchar)(buf, dc);