title: Unable to decode base64 while read the data from console C#
body: <p>I'm facing the issue while converting the encode/decode the data with C#. I have hard-coded the certain base64(encoded) data and its successfully decoded the string. As like below,</p>
  
  <pre><code>string encodedText = "eyJDb25uX0dyb3VwX0lEIjozMywiVXNlckVtYWlsIjoiVGVzdHNlcnZpc2VA\nZ21haWwuY29tIiwiVXNlclBhc3N3b3JkIjoib1ZkTEREWUVfX3FuSnZFSE1W\ncnR5WU5ZZzJSTnNzUnpaWG5KaFJMcCIsIkJhc2VVUkwiOiJodHRwOi8vbG9j\nYWxob3N0OjMwMDAifQ==\n";
  byte[] data = Convert.FromBase64String(encodedText);
  string decodedString = Encoding.UTF8.GetString(data);
  </code></pre>
  
  <p>But, while reading the same value from the console, its failed to decode the data. For example,</p>
  
  <pre><code>string readLine = Console.ReadLine();
  Console.WriteLine("Received Data :: " + readLine); // Exactly same data received here
  byte[] encodedByte = Convert.FromBase64String(readLine); //Failed here?
  string configData = System.Text.Encoding.UTF8.GetString(encodedByte);
  </code></pre>
  
  <p>The second code failed with the below error message</p>
  
  <pre><code>Unhandled exception. System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
     at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
     at System.Convert.FromBase64String(String s)
  </code></pre>
  
  <p>Note:</p>
  
  <p>I have noticed that and removed all the \n from the given string. Now, its working fine. But, I'm not sure how to remove that \n programatically. I tried with the below codes, but it's does not working,</p>
  
  <pre><code>readLine = Regex.Replace(readLine, @"\t|\n|\r", String.Empty);
  </code></pre>
  
  <p>And also tried with,</p>
  
  <pre><code>readLine = readLine.Replace("\n", String.Empty);
  </code></pre>
  
  <p>It would be much appreciated if anyone help on this.</p>