title: Replacing a unicode character in UTF-8 file using delphi 2010
body: <p>I am trying to replace character (decimal value 197) in a UTF-8 file with character (decimal value 65) </p>
  
  <p>I can load the file and put it in a string (may not need to do that though)</p>
  
  <pre><code>SS := TStringStream.Create(ParamStr1, TEncoding.UTF8);
  SS.LoadFromFile(ParamStr1);
  //S:= SS.DataString;
  //ShowMessage(S);
  </code></pre>
  
  <p>However, how do i replace all 197's with a 65, and save it back out as UTF-8?    </p>
  
  <pre><code> SS.SaveToFile(ParamStr2);
   SS.Free;
  </code></pre>
  
  <p>-------------- EDIT ----------------  </p>
  
  <pre><code>reader:= TStreamReader.Create(ParamStr1, TEncoding.UTF8);
   writer:= TStreamWriter.Create(ParamStr2, False, TEncoding.UTF8);
  
   while not Reader.EndOfStream do
   begin
    S:= reader.ReadLine;
    for I:= 1 to Length(S)  do
    begin
     if Ord(S[I]) = 350 then
     begin
      Delete(S,I,1);
      Insert('A',S,I);
     end;
    end;
    writer.Write(S + #13#10);
   end;
  
   writer.Free;
   reader.Free;
  </code></pre>