title: looking for samples to validate UTF-8
body: <p>Suppose I have a byte stream (array), and I want to write code (using .Net C#) to validate whether it is valid UTF-8 byte sequence or not. I want to write code from scratch because I need to report the exact location where there is invalid byte sequences and may even remove invalid bytes -- not just want to get yes or no about whether the byte stream/array is valid.</p>
  
  <p>Are there any sample codes to make reference? If no C# code, simple samples in C++/Java are also appreciated. Thanks!</p>
  
  <p>For the invalid byte sequences of UTF-8, I mean</p>
  
  <p><a href="http://en.wikipedia.org/wiki/UTF-8#Invalid_byte_sequences" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/UTF-8#Invalid_byte_sequences</a></p>
  
  <p>thanks in advance,
  George</p>