On Sun, Mar 7, 2010 at 7:29 PM, Silvio Clecio <[email protected]> wrote:
> I'm trying to create a function to replace accented characters by single
> characters, e.g:

Maybe you should show how your code for this is.

The easiest way is making a large if block.

> Code:
> ---------------------------------
> procedure TForm1.Button1Click(Sender: TObject);
> begin
>  Edit2.Text := Edit1.text[1]
> end;
> ---------------------------------

There is no problem here, Lazarus encodes strings using UTF-8. This
code is simply completely flawed. The [] operator refers to bytes of
the string, so you are only taking the first byte of the string and
assigning it to the text of the TEdit, which obviously only works for
single byte characters, but UTF-8 chars usually have 1, 2 or 3 bytes.

I suggest that you read more on UTF-8: http://en.wikipedia.org/wiki/UTF-8

-- 
Felipe Monteiro de Carvalho

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to