[Lazarus] Case error with cirilyc
Vincent Snijders
vsnijders at vodafonevast.nl
Thu Sep 17 08:09:58 CEST 2009
dmitry boyarintsev schreef:
> Rigel, do you mean?
>
> var
> ch : char;
> begin
> ch := 'Q';
> case ch of
> 'Q': writeln('Q');
> 'Z': writeln('Z');
> 'Я': writelh('Я'); // cyrillic character gives the error
> end;
> end.
>
> If your unit is new one (created by Lazarus, rather than Delphi), then
> cyrillic characters are encoded as UTF8 character, that's 2 character
> strings.
>
> You can achieve the same effect as Delphi, by changing file's encoding
> to the proper Ansi encoding:
> Right Click on the editor -> File Settings -> Encoding -> select the
> required encoding (current Windows Ansi encoding)
> (for example cp1251 for Russian charset)
>
But this does not work if the ch is from a LCL component.
E.g
ch := Label.Caption[1];
Because the caption will be UTF8 encoded.
Vincent
More information about the Lazarus
mailing list