Hi Jonas,

On 01/30/2011 03:13 AM, Jonas Maebe wrote:

On 29 Jan 2011, at 17:05, Pew (piffle.the.cat) wrote:

I have a problem where ord() of a character (single string index) returns the 
wrong value. the character is a 'o' which is a 111 value but the ord of it 
returns 121 into an integer. What am I doing wrong?

Is that Lazarus code? If so, the string will be utf-8 encoded and you cannot 
assume that str[i] corresponds to the i'th character of the string. Even if 
it's not Lazarus code, it could still be utf-8 encoded depending on what the 
source of the string is and/or the locale settings of the system.

Yes, it is Lazarus code. Okay so I think that we have found the problem. Now how do I fix it?

The string is a string parameter to a procedure. Should I change the type of this declaration?, or is there something else that I should do? If I should change it's type, then what to?

procedure TFixedFont.WriteText2(x, y: integer; Txt: string;
  var PaintBox1: TPaintBox);

http://pastebin.com/P7Wpkekx



Jonas_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to