Показать сообщение отдельно
  #42  
Старый 14.07.2010, 21:11
Аватар для PhoeniX
PhoeniX PhoeniX вне форума
Always hardcore!
 
Регистрация: 04.03.2009
Адрес: СПб
Сообщения: 3,239
Версия Delphi: GCC/FPC/FASM
Репутация: 62149
По умолчанию

Нашёл вот это:
Код:
function IsTextUTF8(const Source: AnsiString): Boolean;
var
  Chr: Byte;
  I, Octets: Integer;
  AllAscii: Boolean;
begin
  if Source <> '' then begin
    Octets := 0;
    AllAscii := True;
    for I := 1 to Length(Source) do begin
      Chr := Byte(Source[i]);
      if Chr and $80 <> 0 then
        AllAscii := False;
      if Octets = 0 then begin
        if Chr >= $80 then begin
          repeat
            Chr := Chr shl 1; Inc(Octets);
          until Chr and $80 = 0;
          Dec(Octets);
          if Octets = 0 then begin
            Result := False;
            Exit;
          end;
        end;
      end else begin
        if Chr and $C0 <> $80 then begin
          Result := False;
          Exit;
        end;
        Dec(Octets);
      end;
    end;
    Result := (Octets <= 0) and not AllAscii;
  end else
    Result := False;
end;

А функция IsTextUnicode в Delphi7 есть "искаропки", можно юзать
Конвертация... ща найду толковое что-нибудь
__________________
Оставайтесь хорошими людьми...
VK id2634397, ds [at] phoenix [dot] dj
Ответить с цитированием