function UTF8Translit(s: String): String;
const
rus : string = 'абвгдеёжзийклмнопрстуфхцчшщьыъэюя';
rusC: string = 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯ';
lat : array[1..33] of string = ('a', 'b', 'v', 'g', 'd', 'e', 'yo', 'zh', 'z',
'i', 'y', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'ts',
'ch', 'sh', 'sch', '', 'y', '', 'e', 'yu', 'ya');
var
ch: string; // IMPORTANT: must not be "char"
p: Integer;
pC: Integer;
i: integer;
begin
Result := '';
for i:=1 to UTF8Length(s) do
begin
ch:= NthCodePoint(s,i);
p := UTF8Pos(ch, rus);
pC:= UTF8Pos(ch, rusC);
if p < 1 then
begin
if PC < 1 then
Result := Result + ch
else
if length(lat[pC])>0 then
begin
Result := Result + UpperCase(lat[pC][1]);
if length(lat[pC])>1 then
for p:=2 to length(lat[pC])do
Result := Result + lat[pC][p];
end;
end
else
Result := Result + lat[p];
end;
end;