[Lazarus] Problems with accented characters
Silvio Clecio
silvioprog at gmail.com
Sun Mar 7 23:57:45 CET 2010
Hi Felipe
I know this link on the wiki, but it did not really help you solve the
problem in TCustomEdit.
See this demo, I explain it better how to reproduce the error:
http://groups.google.com.br/group/lazarus-brasil/web/be_bug_tests.zip?hl=pt-BR
Thanks.
Felipe Monteiro de Carvalho escreveu:
> On Sun, Mar 7, 2010 at 7:29 PM, Silvio Clecio <silvioprog at gmail.com> 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
--
[]'s
Silvio Clécio
--
programmer ObjectPascal - Blog: http://blog.silvioprog.com.br
programmer ObjectPascal - Site: http://www.silvioprog.com.br
programmer ObjectPascal - Twitter: http://twitter.com/silvioprog
--
grupo Lazarus-BR no Google - http://groups.google.com/group/lazarus-br/
--
Mensagem assinada com PGP Public Key, Ver.: GnuPG v1.4.9 (GNU/Linux)
More information about the Lazarus
mailing list