fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. // Code Point U+1F47E
  8. Console.WriteLine("\\U0001F47E = \U0001F47E");
  9. Console.WriteLine("");
  10.  
  11. // Specifying the UTF-16 Surrogate Pair raises a "CS1009
  12. // Unrecognized escape sequence" error in LINQPad and Visual
  13. // Studio 2015.
  14. //
  15. // Here it returns the default replacement character due to ignoring
  16. // the first 4 hex digits and only seeing 0xDC7E, which is a
  17. // surrogate code unit.
  18. Console.WriteLine("\\UD83DDC7E = \UD83DDC7E");
  19. Console.WriteLine("");
  20.  
  21. // The following is invalid, and raises an error in LINQPad and in
  22. // Visual Studio 2015. But here it returns an empty string due to
  23. // ignoring the first 4 hex digits and only seeing 0x0000.
  24. Console.WriteLine("\\UD83D0000 = \UD83D0000");
  25. Console.WriteLine("");
  26.  
  27. // The following are invalid, and raises an error in LINQPad and in
  28. // Visual Studio 2015. But here it returns an "A" due to ignoring
  29. // the first 4 hex digits and only seeing 0x0041.
  30. Console.WriteLine("\\UD83D0041 = \UD83D0041");
  31. Console.WriteLine("\\U80000041 = \U80000041");
  32. Console.WriteLine("\\UFFFF0041 = \UFFFF0041");
  33. Console.WriteLine("");
  34.  
  35. // The following is invalid, and raises an error HERE (as expected),
  36. // due to the first 4 hex digits being below the 0x8000 mark.
  37. //Console.WriteLine("\\U7FFF0041 = \U7FFF0041");
  38. }
  39. }
Success #stdin #stdout 0.01s 131520KB
stdin
Standard input is empty
stdout
\U0001F47E = 👾

\UD83DDC7E = �

\UD83D0000 = 

\UD83D0041 = A
\U80000041 = A
\UFFFF0041 = A