delphi代码转C#代码中的有关问题

delphi代码转C#代码中的问题
我在对一个delphi的函数进行转换成C#的处理中,运行没问题,但是返回值不一样,delphi的代码是在delphi7下编译的,代码如下:
function Enc(sInput: string): string;stdcall;
Const
   AllChar:string='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ';
Var
   sOutput :string;
   iPin:byte;
   A: Boolean;
begin
  Result := '';
   if sInput = '' Then
      sOutput := ''
   else
   begin
     A := False;
      if Length(sInput) Mod 2 = 1 then
      begin
        A := True;
        sInput := sInput + '_';
      end;
      for iPin:=1 to Length(sInput) do
      begin
        sOutput := sOutput+Char(Ord(sInput[iPin]) + 128);
      end;
      if A then sOutput := sOutput + '_';
   end;
   Result := PChar(Trim(sOutput));
end;
,我转换成C#,是这样写的:
public string Enc(string sInput)
        {
            string AllChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            string sOutput;
            byte iPin;
            Boolean A;
            int len = 0;
            Int32 K = 0;
            sOutput = "";
            if (sInput == "") sOutput = "";
            else
            {
                A = false;
                len = sInput.Length;
                if (len % 2 == 1)
                {
                    A = true;
                    sInput = sInput + "_";
                }
                for (iPin = 0; iPin < len; iPin++)
                {
                    K = Convert.ToInt32(sInput[iPin]);
                    sOutput = sOutput + (char)(Convert.ToInt32(sInput[iPin])+128);
                }
                if (A == true)
                {
                    sOutput = sOutput + "_";
                }
            }
            return sOutput;
        }

运行是没有问题,但是执行结果不一样,在delphi下,字符串“淤釉磐”的执行结果是“SYSTEM”,可是在C#下就不行,delphi7下是采用ANSI码,而C#中是采用UniCode编码,不知道是不是这个问题,但是一直解决不了,期望大能解惑,谢谢
------解决方案--------------------
c#改成如下

        public string Enc(string sInput)
        {
            string AllChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            string sOutput;
            byte iPin;
            Boolean A;