[Lazarus] Case error with cirilyc

Rigel Rigel rigel at gbg.bg
Thu Sep 17 14:56:03 CEST 2009


 Dmitry, 

I follow your instruction and now project compiles. But CASE don't effect on cirilyc symbol. In example output is without symbol. Lat symbols are ok.

Vincent, attachment without .exe, .o, .ppu is too big to and again restruction of mail can't allow me to send it.

Example with memo1, memo2, button1:
procedure TForm1.Button1Click(Sender: TObject);
var
  stInp: String;
  stOut: String;
  i: integer;
begin
  stOut := '';
  stInp := Memo1.Lines.Text;
  for i := 1 to length(stInp) do
  Begin
     // Cirilyc case
    case stInp[i] of
      'а': stOut := stOut + 'a'; //Cir
      'б': stOut := stOut + 'b';
      'в': stOut := stOut + 'v';
      'г': stOut := stOut + 'g';
      'д': stOut := stOut + 'd';
      'a': stOut := stOut + 'a'; //Lat
      'b': stOut := stOut + 'b';
      'v': stOut := stOut + 'v';
      'g': stOut := stOut + 'g';
      'd': stOut := stOut + 'd';
    End;
  end;
  stOut := stOut + stInp[i];
  Memo2.Lines.Text := stOut;
end;                       

Thanks,
Rigel



 >-------- Оригинално писмо --------
 >От:  dmitry boyarintsev 
 >Относно: Re: [Lazarus] Case error with cirilyc
 >До: Lazarus mailing list 
 >Изпратено на: Четвъртък, 2009, Септември 17 08:57:41 EEST

 >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)
 >
 >Changing the encoding should fix the problem, but you might have a
 >side effect on other (non Windows) systems.
 >
 >thanks,
 >dmitry
 >
 >--
 >_______________________________________________
 >Lazarus mailing list
 >Lazarus at lists.lazarus.freepascal.org
 >http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
 >




More information about the Lazarus mailing list